UILineBreakModeWordWrap已弃用
这是我的代码:
CGSize s = [string sizeWithFont:[UIFont systemFontOfSize:20] constrainedToSize:CGSizeMake(self.view.bounds.size.width - 40, CGFLOAT_MAX) // - 40 For cell padding lineBreakMode:UILineBreakModeWordWrap]; 我收到一个警告,UILinebBreakModeWordWrap在iOS 6中已经被弃用了。
 你需要在iOS 6中使用NSLineBreakByWordWrapping 
对于你的代码尝试这个:
 NSString *string = @"bla"; CGSize s = [string sizeWithFont:[UIFont systemFontOfSize:20] constrainedToSize:CGSizeMake(self.view.bounds.size.width - 40, CGFLOAT_MAX) // - 40 For cell padding lineBreakMode:NSLineBreakByWordWrapping]; 
标签上的例子是:
 [label setLineBreakMode:NSLineBreakByWordWrapping]; 
代替
 label.lineBreakMode = UILineBreakModeWordWrap; 
为了保持向后兼容,你可以创build一个macros,如下所示:
 #ifdef __IPHONE_6_0 # define LINE_BREAK_WORD_WRAP NSLineBreakByWordWrapping #else # define LINE_BREAK_WORD_WRAP UILineBreakModeWordWrap #endif