首页 技术 正文
技术 2022年11月13日
0 收藏 466 点赞 4,667 浏览 1179 个字

我们在些程序时会发现苹果里面有好多非常好的提示

比如:

1.每次SDK升级后 一些方法的方法已经过时了,这时候会给你提示描述该方法已经过期(作用:1.兼顾老版本 2.给开发者一个提示)

2.有时候项目里面父类的方法没有重写 在控制台会给你提示

3.可以穿多个参数的方法 比如UIAlertView 的创建方法里面最后一个参数可以传多个用…代替

UIAlertView* alertView [[UIAlertView alloc]initWithTitle:<#(nullable NSString *)#> message:<#(nullable NSString *)#> delegate:<#(nullable id)#> cancelButtonTitle:<#(nullable NSString *)#> otherButtonTitles:<#(nullable NSString *), ...#>, nil]

以上是我目前在项目里面遇到的

应用场景:

1.如果自己写的方法也已经过时了 要弃用了 如何给其他成员一个提示呢 ?

//属性过时了的描述方法
@property (nonatomic, copy) NSString *township __attribute((deprecated("该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取."))); //方法过时或不能用的描述+ (NSString *)getWeiboAppSupportMaxSDKVersion __attribute__((deprecated));+ (NSString *)getWeiboAppSupportMaxSDKVersion __attribute__((deprecated("这里面可以写描述哦")));//方法不能用的描述
- (instancetype)init __attribute__((unavailable));//总结
// 不管是方法还是属性的过期或不能用的提示格式是
__attribute__((deprecated))
__attribute__((deprecated("这个里面可以写描述哦当让也可以不写像上面那样")))

2.字节写个父类其中有的方法想让子类去重写实现

#pragma mark - must override methods- (void)handleChangeAlbum:(UIButton *)sender {    NSAssert(NO, @"sub class should override");}- (NSString)handleAlbumListCellSelected:(NSNotification *)aNotify {    NSAssert(NO, @"sub class should override");
return nil;}

3.想传多个参数用…代替  这个稍后再给方法

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,087
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,562
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,412
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,185
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,821
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905