iOS 4.0之后NSDate的addTimeInterval方法被deprecated了
- (id)addTimeInterval:(NSTimeInterval)seconds
可以用dateByAddingTimeInterval来代替
- (id)dateByAddingTimeInterval:(NSTimeInterval)seconds;
iOS6.0中presentModalViewController过时了
self presentModalViewController:pNewController animated:YES];
替换为
[self presentViewController:pNewController animated:YES completion:nil];
iOS7.0中sizeWithFont过时了
CGFloat textSizeWidth = (self.textLabel != nil) ? [self.textLabel sizeWithFont:self.label.font constrainedToSize:maxLabelSize lineBreakMode:NSLineBreakByTruncatingTail].width : 0;
替换为
NSDictionary * tdic = [NSDictionary dictionaryWithObjectsAndKeys:self.label.font, NSFontAttributeName,nil];
CGFloat textSizeWidth =[self.textLabel boundingRectWithSize:maxLabelSize options:NSStringDrawingUsesLineFragmentOrigin |NSStringDrawingUsesFontLeading attributes:tdic context:nil].size.width;
本文介绍了 iOS 开发中一些已过时的方法及其替代方案,包括 NSDate 的 addTimeInterval 方法被 deprecated 后如何使用 dateByAddingTimeInterval 替代,presentModalViewController 在 iOS6 中过时后的正确用法,以及 iOS7 中 sizeWithFont 方法的替代实现。
1万+

被折叠的 条评论
为什么被折叠?



