利用@synthesize可以给在.m文件中给.h文件中的属性重新定义新的名称
@synthesize  firstname = anothername;
firstname是在.h文件中定义的,新定义的属性名称为anothername
在.m文件中使用属性anothername时,就相当于使用firstname属性,对anothername进行赋值也相当于对firstname属性进行赋值。 注意:重新定义的属性名称只能在.m文件中使用,在其他文件无法使用这个属性名,只能使用原来的属性名。

@synthesize的使用的更多相关文章

  1. 1.ios synthesize有什么作用

    ###1.ios synthesize有什么作用 当定义了一系列的变量时,需要写很多的getter和setter方法,而且它们的形式都是差不多的,所以Xcode提供了@property和@synthe ...

  2. synthesize的作用

    @synthesize是对属性的实现,实际上就是制定setter和getter操作的实例变量的名称   举个栗子: @synthesize array;  默认操作的实例变量和属性同名 @synthe ...

  3. synthesize 与dynamic的区别

    官方文档解释: @synthesize will generate getter and setter methods for your property. @dynamic just tells t ...

  4. IOS 关键字self,super,copy, retain, assign , readonly , readwrite, nonatomic、 @synthesize、@property、@dynamic

    IOS 关键字self,super,copy, retain, assign , readonly , readwrite, nonatomic.                     @synth ...

  5. 属性(@property)、@synthesize

    先前我们学的实例变量是这样的 { int _age; int _height; int age; } 后来学属性 @property int age; 看到@property 会自动编译生成某个成员变 ...

  6. OC- @property @synthesize

    @property 1,在@interface中 2,自动生成setter和getter的声明 #import <Foundation/Foundation.h> @interface P ...

  7. @synthesize的正确使用方式

    @synthesize的正确使用方式 一. @synthesize的错误使用方式 类1和类2是继承关系, name是类1的属性 但是类2的实现里加入了@synthesize name = _name; ...

  8. @synthesize vs. @dynamic

    @synthesize will generate getter and setter methods and corresponding instance variable for your pro ...

  9. OC语言@property @synthesize和id

    OC语言@property @synthesize和id 一.@property @synthesize关键字 注意:这两个关键字是编译器特性,让xcode可以自动生成getter和setter的声明 ...

  10. Objective-C中的@property和@synthesize用法

    @代表“Objective-C”的标志,证明您正在使用Objective-C语言 Objective-C语言关键词,@property与@synthesize配对使用. 功能:让编译好器自动编写一个与 ...

随机推荐

  1. bootstrap轮播图--兼容IE7

    <!DOCTYPE html> <html> <head> <title>Bootstrap轮播</title> <meta char ...

  2. ThinkPHP框架如何修改X-Powered-By

    以前用ThinkPHP框架开发了一个小网站,前几天查询页面HTTP状态发现,里面有一项: X-Powered-By: ThinkPHP 2.0 这样虽然没什么,但感觉如果别有用心的人查询会知道你是用这 ...

  3. CSS 声明( Declarations )

    CSS 声明1可以为空,或者由 CSS 特性( property ),后加一个冒号 ":",跟着是一个特性的值构成.中间可以有空格将它们隔开. 可用以下方式表达: property ...

  4. IO流--字符流

    import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java ...

  5. 189. Rotate Array -- 将数组前一半移到后一半

    Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array ...

  6. OC 继承子类对象调用方法机制 子类对象访问父类中的实例变量

    在继承中,子类对象如何调用到正确方法的机制 每一个Objective - C对象都有一个隐藏的指针指向类的代码,当向一个对象发送消息的时候,当前的对象会首先在当前类里去查找相应的方法,如果找到的话,直 ...

  7. css3导航-磊哥

    <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>    < ...

  8. Excel 函数记录

    1.四舍五入:round(数据,小数位数)

  9. ...python の 学习

    5.14 ...上次学python 好像是一个月前.. 写点东西记录下叭.. 现在在看李老大写的博客写..可能直接开抄代码... 感觉自己写的总是爬不成功,之前写的爬豆瓣影评的爬虫还是残的... 1. ...

  10. oracle Redhat64 安装

    详细可以参考:http://blog.csdn.net/chenfeng898/article/details/8782679 直接执行如下yum安装命令后,如果再出错,跳到2 yum -y inst ...