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 解决方法: 详细的解 ...
随机推荐
- leetcode problem 6 ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like ...
- JavaScript语言用10张图
JavaScript 语言基础知识点总结,用图片树形结构说明.包括Windows对象.JavaScriptDOM基本操作.JavaScript变量.JavaScript数据类型.JavaScript运 ...
- kindeditor编辑器代码过滤解决方法.
很多朋友在使用Kindeditor编辑器的时候都会遇到这样一个问题,如:给A标签加上title属性过后,浏览的时候,却神奇般地发现title属性没有了.再次切换html源代码的时候,返现编辑器将tit ...
- (转载)delphi中获取汉字的拼音首字母
delphi中获取汉字的拼音首字母1.py: array[216..247] of string = ({216}'CJWGNSPGCGNESYPB' + 'TYYZDXYKYGTDJNMJ' + ' ...
- #Leet Code# Best Time to Buy and Sell Stock
描述:数组 A,对于 i < j, 找到最大的 A[j] - A[i] 代码: class Solution: # @param prices, a list of integer # @ret ...
- Listview 加载更多
JQM Listview 加载更多 demo - Warren的个人主页 JQM Listview 加载更多 Demo 测试数据1 测试数据2 测试数据3 测试数据4 显示更多 Page Footer ...
- 如何让ubuntu启动时打印字符信息----字符启动
一.概述 要想实现字符启动,需要修改grub.cfg(启动配置文件),将“静态启动”改为“字符启动”. 但是grub.cfg通常只作为只读文件,修改它时实际上修改的是其他的文件然后再通过update- ...
- 【BZOJ1901】 Zju2112 Dynamic Rankings(树套树)
[题意] 给定一个含有n个数的序列a[1],a[2],a[3]--a[n], 程序必须回答这样的询问:对于给定的i,j,k,在a[i],a[i+1],a[i+2]--a[j]中第k小的数是多少(1≤k ...
- 李洪强iOS开发Swift篇—09_属性
李洪强iOS开发Swift篇—09_属性 一.类的定义 Swift与Objective-C定义类的区别 Objective-C:一般需要2个文件,1个.h声明文件和1个.m实现文件 Swift:只需要 ...
- android原生系统裁剪
Andriod 4.0.4系统包 Andriod 4.1.1系统包 说明 ApplicationsProvider.apk ApplicationsProvider.apk 应用程序存储. 程序管 ...