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 解决方法: 详细的解 ...
随机推荐
- 【转】Vim命令合集以及乱码问题解决
乱码问题 """""""""""""""" ...
- Mysql DOC阅读笔记
Mysql DOC阅读笔记 转自我的Github Speed of SELECT Statements 合理利用索引 隔离调试查询中花费高的部分,例如函数调用是在结果集中的行执行还是全表中的行执行 最 ...
- WORDPRESS插件开发(二)HELLO WORLD改进版
在上一篇文章中WORDPRESS插件开发(一)HELLO WORLD,演示了Hello World的最简单实现,只是在每篇文章的后面加入Hello World字符,而且字符也是写死的. 如果用户需要自 ...
- WORDPRESS插件开发学习(一)HELLO WORLD
WORDPRESS插件开发学习系列文章第一篇,在每篇文章的后面追加固定的字符“Hello World” 一.打开wordpress目录->wp-content->plugins 二.在pl ...
- Python的简介以及安装和第一个程序以及用法
Python的简介: 1.Python是一种解释型.面向对象.动态数据类型的高级程序设计语言.自从20世纪90年代初Python语言诞生至今,它逐渐被广泛应用于处理系统管理任务和Web编程.Pytho ...
- 黑马程序员-------.net基础知识一
一 初识.net .net是一种多语言的编程平台,可以用多达几十种的语言来进行开发,而C#就是基于.net平台的其中一种开发语言. 它的特点是: ⒈多平台:该系统可以在广泛的计算机上运行,包括从服务 ...
- 实现CodeFirst自动数据迁移无需命令
本主题假设您掌握了实体框架中 Code First 迁移的基本知识. 借助自动迁移功能,您无需对您所做的每一个更改都在程序包管理器控制台中运行Update-Database 命令. 启用迁移 只需执行 ...
- 毕向东_Java基础视频教程第19天_IO流(06~10)
第19天-06-IO流(装饰设计模式) 装饰设计模式: 当想要对已有的对象进行功能增强时, 可以定义类,将已有对象传入,基于已有的功能,并提供加强功能.那么这个自定义的类称为装饰类. 装饰类通常会通过 ...
- bzoj 1576: [Usaco2009 Jan]安全路经Travel 树链剖分
1576: [Usaco2009 Jan]安全路经Travel Time Limit: 10 Sec Memory Limit: 64 MB Submit: 665 Solved: 227[Sub ...
- SDUT 2352 Run Length Encoding
点我看题目 题意 :将给定的字符串编码,编码的规则根据两条,1.如果字符串里有连续相等的字符,就变为两个字符,一个是这些连续相同的字符的个数,另一个是这个字符,但是如果数量超过了9个,那就输出9再输出 ...