iOS 9新特性
来源:互联网 发布:离线翻译软件 知乎 编辑:程序博客网 时间:2024/05/01 13:16
/*
*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{
[supertouchesBegan:touches withEvent:event];
}
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view.
}
__kindof
#import "KindViewController.h"
@interface KindViewController ()
@end
/**
__kindof :表示当前类或者它的子类
*/
@implementation KindViewController
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// 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
- iOS 9 新特性
- iOS 9新特性
- iOS 9 新特性
- iOS 9 新特性
- iOS 9新特性
- iOS 9 的新特性
- iOS 9 新特性介绍
- 关于iOS 9 的一些新特性
- iOS 6 7 8 9新特性
- IOS 新特性
- IOS新特性
- iOS 7新特性
- iOS 新特性
- iOS 新特性
- iOS新特性
- ios 新特性
- iOS新特性
- iOS 8 新特性
- Android之结束所有activity-使用Intent.FLAG_ACTIVITY_CLEAR_TOP
- Java制作说明书并使用说明文档,Math,API
- 欢迎使用CSDN-markdown编辑器
- centos安装svn服务器详细步骤
- How To Do Research In the MIT AI Lab_1_Reading AI
- iOS 9新特性
- hdu4756(最小生成树最佳替换边)
- 设置Button背景渐变效果和点击效果
- [LeetCode]problem 1. Two Sum
- 2009年北航机考题
- sql优化
- 2_Getting connected
- hdu1312Red and Black (dfs)
- 第三方登录+分享