use of undeclared identifier *** , did you mean ***. in xcode
A property is not the same thing os a instance variable, you should read a little bit of them, there's plenty of sources in the internet.
Summarizing, a property is the combination of the instance variable (by default, automaticated declaraded with a underscore), and it's get and set methods.
To access the property inside your class, you should call for self.propertyName
, in your case it would be self.myTextfield
. This will access the gererated get method of the property. You can always, of course if you are inside the class, skip the get method and access the variable directly. In this case, it would be _myTextfield
.
If you are not confortable with this automaticated instance variable generated, you can always declare your own and bind it with the property with the @synthesize
command. Like this:
@synthesize myTextfieldProperty = myTextfieldVariable;
Here's more information about the synthesize
. As I said before, this command binds one iVar to a property. So, when you execute the line above, inside your class, you can either reference to the iVar directly, calling myTextfieldVariable
, or by the property, self.myTextfieldProperty
(there are a few differences actually between them, but I'm not entering in details).
If you don't write the synthesize
, what xcode does for you, automatically, is this:
@synthesize myTextfield = _myTextfield;
So, in your case, as you does not synthesize your property, xcode automatically created the iVar with the underscore in the beginning. It's just a pattern that xcode follows.
The line @synthesize myTextfield;
, without binding an iVar directly, is simple the same as
@synthesize myTextfield = myTextfield;
i.e. you are creating an iVar with the same name of your property. And why these two lines are actyally the same thing? I don't know, again, it's just a pattern that xcode follows.
use of undeclared identifier *** , did you mean ***. in xcode的更多相关文章
- 【原】iOS 同时重写setter和getter时候报错:Use of undeclared identifier '_name';did you mean 'name'
写了那么多的代码了,平时也没有怎么注意会报这个错误,因为平时都很少同时重写setter和getter方法,一般的话,我们大概都是使用懒加载方法,然后重写getter方法,做一个非空判断.然后有时候根据 ...
- iomanip,setw(),setw: undeclared identifier
今天使用setw(),提示setw: undeclared identifier,上网查了下,原来是没有包含头文件iomanip,现摘录如下: iomanip #include <iomanip ...
- error C2065: 'assert' : undeclared identifier
F:\VC6.0 : error C2065: 'assert' : undeclared identifier 导入#include <assert.h>
- 使用某些Widows API时,明明包含了该头文件,却报错“error C2065: undeclared identifier”
在使用一些新版本的API,或者控件的新特性(比如新版的ComCtl32.dll)的时候,你可能会得到“error C2065: undeclared identifier.“这个错误.原因是这些功能是 ...
- loadrunner场景报错:Error: CCI compilation error -/tmp/brr_5d65oV/netdir/E/\320\324/Action.c (318): undeclared identifier `LAST'解决思路
在windows下写的脚本编译通过 但是拿到linux agent场景执行中就会提示如下,同样的脚本在windows agent下没有任何问题 agent连的是linux负载机 通过脚本一行一行排查, ...
- use of undeclared identifier 'xxxxxxx方法名'
在*.m文件中,编写一个方法,出现了 use of undeclared identifier 'xxxx方法名'. 遇到这种情况: 首先要看,*.h 文件是否定义了该方法. 其次,要检查一下,方 ...
- 蛋疼的Action.c (141): undeclared identifier `LAST'异常
之前这个脚本运行了很久都没有问题,今天突然在场景运行不了: Action.c (141): undeclared identifier `LAST' 害的老子一直在纠结,这个关联函数没有问题啊,怎么一 ...
- error C2065: 'CArchiveStream' : undeclared identifier
release:模式下 问题: 在导入JPEG文件时要使用到 CArchiveStream类 但是编译的时候会出现 'CArchiveStream' : undeclared ide ...
- error C2065: ‘_bstr_t’ : undeclared identifier
转自VC错误:http://www.vcerror.com/?p=828 问题描述: error C2065: '_bstr_t' : undeclared identifier 解决方法: 详细的解 ...
随机推荐
- jquery api 笔记(2) 事件 事件对象
事件 #1.resize() 缩放窗体:window.resizeTo(width, height); 并不是兼容做法. #2 .scroll() ->获取滚动条的位置: .scro ...
- 降低IIScup使用率,提高性能
智能提醒webservice在高峰期间CPU使用率达到50%,内存消耗2G优化方法:启用IIS的Web Garden. 步奏如下: 在IIS7中,选择对应的应用程序池 然后右键高级设置. 把其中的最大 ...
- Sumbline编译Less
Less教程 Sublime Text 2的Less2Css插件介绍与安装 网址 http://fdream.net/blog/article/783.aspx 如果出现node.exe不是内部命令的 ...
- 京东电话面试——PHP开发
1.学过<数据结构>吗?你学过的计算机相关课程有哪些? 2.web操作中,当你输入一个url到看到页面,描述一下这中间发生了什么? 3.TCP/IP的请求方式都有哪些? 4.POST和GE ...
- php常用函数集
网络请求: /** * 发起HTTPS请求 */ function curl_post($url,$data=null,$header=null,$post=0) { //初始化curl $ch = ...
- Android使用pull解析xml
一.理论准备 Pull解析器的运行方式与 SAX 解析器相似.它提供了类似的事件,如:开始元素和结束元素事件,使用parser.next()可以进入下一个元素并触发相应事件.跟SAX不同的是, ...
- VS2010皮肤控件介绍
在我们平时使用的各种工具中,如QQ,迅雷,以及各种空间等,都提供了一些换肤功能,可以让我们选择各种我们喜欢的界面.本文就对VS中常用的窗口程序做一个简单的换肤,利用一个dll文件来进行实现. 首先我们 ...
- socket.io
http://www.cnblogs.com/fullhouse/archive/2011/07/18/2109936.html http://www.cnblogs.com/fullhouse/ar ...
- 修改sphinx最大输出记录数
修改sphinx最大输出记录数 归纳如下: Sphinx的查询默认最大记录数是:1000,而我们想更改这个数值.就需要更改三个地方. 1是更改sphinx.conf配置文件的:max_matches ...
- JavaScript clearInterval定时器失效原因
检查下是不是setInterval重复执行(两次以上<!-- 文件上传板块 --> <div id="adUploadWindow" class="ea ...