iOS API更新

更新列表

5th,August,2016

stringByAddingPercentEscapesUsingEncoding

Deprecated in iOS9.0:

urlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

Updated:

[urlStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

31st,August,2016

UIAlertView

Deprecated in iOS9.0:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"超出100字限制" message:@"" delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles: nil];
[alert show];

Updated:

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"超出100字限制" message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];

这里写图片描述


1st,Nov,2016

setStatusBarHidden

隐藏导航栏
Deprecated in iOS9.0:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

Updated:

“Use -[UIViewController prefersStatusBarHidden]”

// 在对应的viewController中重写该方法,返回YES.默认返回为NO,即不应藏导航栏
- (BOOL)prefersStatusBarHidden {
    return YES;
}

2rd,Nov,2016

计算文本高度

Deprecated in iOS7.0:

CGSize size = [strText sizeWithFont: textView.font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
    CGFloat height = size.height;

Updated:

- (float)heightForTextView:(UITextView *)textView {
    float fPadding = 8.0;
    CGSize constraint = CGSizeMake(textView.contentSize.width - fPadding*2 - 30*2, MAXFLOAT);
    CGRect rect = [textView.text boundingRectWithSize:constraint options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:textView.font,NSFontAttributeName, nil] context:nil];
    float fHeight = rect.size.height + 16.0;
    return fHeight;
}

持续更新中…

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值