第一、strong关键字与retain关似,用了它,引用计数自动+1
如果person定义如下:
@interface Person : NSObject
@property(nonatomic,strong)Book *book1;
@end @autoreleasepool {
p1=[[Person alloc] init];
Book *book...
分类:
其他好文 时间:
2014-10-14 19:57:39
阅读次数:
207
#import "ViewController.h"@interface ViewController () //保包括这个viewdelegat协议 @property (weak, nonatomic) IBOutlet UITextField *search; //这是...
分类:
其他好文 时间:
2014-10-13 23:23:37
阅读次数:
220
BookStoreCell.h#import @interface BookStoreCell : UITableViewCell@property (strong, nonatomic) UIImageView *bookImageView;@property (strong, nonatomic...
分类:
其他好文 时间:
2014-10-13 23:12:07
阅读次数:
238
以前从未接触过block函数。如果在.h头文件中定义的形式如下的话:@property (nonatomic, copy) void(^fontValueChangedBlock)(void);则应该如此使用block函数_fontValueChangedBlock = ^(){ [self....
分类:
其他好文 时间:
2014-10-13 17:38:19
阅读次数:
167
UITableView 中的Cell选中相关的操作:在TableView中设置Cell相关:@property(nonatomic) BOOL allowsSelection NS_AVAILABLE_IOS(3_0); // default is YES. Controls whether ro....
分类:
移动开发 时间:
2014-10-13 14:04:49
阅读次数:
182
ios设备中有的加速计可以测量出加速度和重力。陀螺仪可用于确定设备的方向与每条坐标轴之间的夹角,可用于读取描述设备围绕其轴的旋转的值。
首先在工程中添加CoreMotion.framework#import #import
@interface ViewController : UIViewController
@property (strong, nonatomic) CMMotionM...
分类:
移动开发 时间:
2014-10-13 12:19:39
阅读次数:
217
效果图:代码结构图:代码:RootTableViewCell.h#import @interface RootTableViewCell : UITableViewCell@property(nonatomic,strong) UIButton * bookLeft;@property(nonato...
分类:
其他好文 时间:
2014-10-11 15:45:35
阅读次数:
165
可以在定义变量时候要求这个变量遵守某个协议,格式:类名 *变量名;但是当类名是id时候,后面变量名的前面不需要*。同理,在@property声明属性的时候也能要求属性遵守某个协议,格式:@property (nonatomic,strong) 类名 *变量名称;同样当时id时后面的*去掉。...
分类:
编程语言 时间:
2014-10-10 04:43:24
阅读次数:
669
更改协议成block,运行,设置一个头文件person.h#import @interface Person : NSObject@property (nonatomic, copy) void (^brak)(void); //声明void类返回void的block类型的brak,@propert...
分类:
其他好文 时间:
2014-10-09 23:34:48
阅读次数:
194
1首先创建一个模型类,一定要遵守NSCoding协意。@interface Contact : NSObject @property (nonatomic, copy) NSString *name;@property (nonatomic, copy) NSString *phone;@endim...
分类:
其他好文 时间:
2014-10-09 22:49:51
阅读次数:
240