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的更多相关文章

  1. 【原】iOS 同时重写setter和getter时候报错:Use of undeclared identifier '_name';did you mean 'name'

    写了那么多的代码了,平时也没有怎么注意会报这个错误,因为平时都很少同时重写setter和getter方法,一般的话,我们大概都是使用懒加载方法,然后重写getter方法,做一个非空判断.然后有时候根据 ...

  2. iomanip,setw(),setw: undeclared identifier

    今天使用setw(),提示setw: undeclared identifier,上网查了下,原来是没有包含头文件iomanip,现摘录如下: iomanip #include <iomanip ...

  3. error C2065: 'assert' : undeclared identifier

    F:\VC6.0 : error C2065: 'assert' : undeclared identifier 导入#include <assert.h>

  4. 使用某些Widows API时,明明包含了该头文件,却报错“error C2065: undeclared identifier”

    在使用一些新版本的API,或者控件的新特性(比如新版的ComCtl32.dll)的时候,你可能会得到“error C2065: undeclared identifier.“这个错误.原因是这些功能是 ...

  5. 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负载机 通过脚本一行一行排查, ...

  6. use of undeclared identifier 'xxxxxxx方法名'

    在*.m文件中,编写一个方法,出现了 use of undeclared identifier 'xxxx方法名'.   遇到这种情况: 首先要看,*.h 文件是否定义了该方法. 其次,要检查一下,方 ...

  7. 蛋疼的Action.c (141): undeclared identifier `LAST'异常

    之前这个脚本运行了很久都没有问题,今天突然在场景运行不了: Action.c (141): undeclared identifier `LAST' 害的老子一直在纠结,这个关联函数没有问题啊,怎么一 ...

  8. error C2065: 'CArchiveStream' : undeclared identifier

    release:模式下 问题: 在导入JPEG文件时要使用到  CArchiveStream类  但是编译的时候会出现  'CArchiveStream'   :   undeclared   ide ...

  9. error C2065: ‘_bstr_t’ : undeclared identifier

    转自VC错误:http://www.vcerror.com/?p=828 问题描述: error C2065: '_bstr_t' : undeclared identifier 解决方法: 详细的解 ...

随机推荐

  1. 高性能、高并发TCP服务器(多线程调用libevent)

    from:http://blog.csdn.net/i_am_jojo/article/details/7587838 本文讲述的TCP服务器是模仿memcache中的TCP网络处理框架,其中是基于l ...

  2. javascript 写状态模式

    写了状态模式的切换,以及分支循环.but 怎么实现子状态嵌套呢? /** * by JackChen 2016-3-26 11.51.20 * * 状态模式: * 一个状态到另一个状态的变换.其实可以 ...

  3. echo、print、print_r、printf、sprintf、var_dump的区别比较

    一.echoecho() 实际上不是一个函数,是php语句,因此您无需对其使用括号.不过,如果您希望向 echo() 传递一个以上的参数,那么使用括号会发生解析错误.而且echo是返回void的,并不 ...

  4. Eyeshot Ultimate 学习笔记(2)

    导入模型 一般情况下,我们自己搭建模型的功力还不够,大多都是在3Dmax中做好模型,导出成模型文件,然后再导入Eyeshot视图中.导入的代码包括: OpenFileDialog openFileDi ...

  5. poj 3304 Segments

    Segments 题意:给你100以内的n条线段,问你是否存在一条直线,使得题给的线段在这条直线上的“投影” 相交于一点: 思路: 1.先要将线段投影相交于一点转变为存在一条直线与所有的线段相交: 很 ...

  6. JavaScript模块化开发实例

    最近接触了一些JavaScript开发的例子,在这里与大家一起分享一下: 例子:当我们一个团队在写Js文件的时候,你一个人写的JS代码自己可以看懂也可以维护,但是别人想对你的JS进行扩展的话,如果都在 ...

  7. VMware下打开Chrome OS遇到没有网络连接可用

    打开ChromeOS.vmx文件,最后一行添加 ethernet0.virtualDev = "e1000" 就能解决.

  8. rabbitmq 测试

    --*-- import pika import datetime connection = pika.BlockingConnection(pika.ConnectionParameters( 'l ...

  9. uva 1453 - Squares

    旋转卡壳算法: 直接在这个上面粘的模板 主要用途:用于求凸包的直径.宽度,两个不相交凸包间的最大距离和最小距离··· 这题就是求凸包的直径 #include <cstdio> #inclu ...

  10. OSAL多任务资源分配机制

    转自OSAL多任务资源分配机制 一.概述      OSAL (Operating System Abstraction Layer),翻译为"操作系统抽象层". 个应用程序对象. ...