iOS 9新特性

/*

 *iOS 9新的关键字 用来修饰属性 或者 方法的参数  方法的返回值

 * 只能修饰对象  不能修饰基本数据类型

 *nullable   可以为空

 *nonnull  不可以为空  非空

 *null_resettable    get不能返回空  set可以为空

 //null_resettable 必须重写get方法 或者set方法, 处理传递的值为空的情况

 

 

 _Null_unspecified 不确定是否为空

 

 **/


//第一种方式

//@property(nonatomic,strong,nullable)NSArray *dataSoure;


//第二种方式


//@property(nonatomic,strong)NSArray *_Nullable dataSoure;


//第三种方式


@property(nonatomic,strong)NSArray *__nullable datasource;








泛型




#import "NewViewController.h"


@interface NewViewController ()


@property(nonatomic,strong)NSMutableArray<NSString*>  *datas;



@end


@implementation NewViewController

/**

 泛型  限制类型

 

 泛型使用的场景

 1 在集合(数组,字典, NSSet)中使用泛型比较常见

 

 泛型好处

 1提高开发的规范  减少程序员之间交流

 2通过集合取出对象 直接当做泛型对象使用 可以直接使用.语法

 

 

 泛型修饰  只能修饰方法的调用

 

 

 

 

 */

 

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

    [super touchesBegan:touches withEvent:event];

    

}

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view.

    

}






__kindof


#import "KindViewController.h"


@interface KindViewController ()


@end

/**

 __kindof :表示当前类 或者它的子类

 */


@implementation KindViewController


- (void)viewDidLoad {

    [super viewDidLoad];

 

    

    // Do any additional setup after loading the view.

}


- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}


/*

#pragma mark - Navigation


// In a storyboard-based application, you will often want to do a little preparation before navigation

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    // Get the new view controller using [segue destinationViewController].

    // Pass the selected object to the new view controller.

}

*/


@end






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值