没有可见的'NSString'的@interface声明了选择器'boundingRectWithSize:options:attributes:context:'

时间:2014-07-11 00:43:27

标签: ios objective-c ios7

我正在尝试运行最近完成的Xcode项目,我有一个错误要排序。非常感谢任何帮助....

错误之前出现语义问题 - 警告如下:

  

未声明的选择器'boundingRectWithSize:options:atrributes:context'

ARC语义问题错误如下:

  

'NSString'没有可见的@interface声明选择器'boundingRectWithSize:options:attributes:context:'

代码如下......

// Since sizeWithFont() method has been depreciated, boundingRectWithSize() method has been used for iOS 7.

if ([NSString instancesRespondToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) {
        NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
        paragraphStyle.lineBreakMode = NSLineBreakByClipping;
        CGRect requiredLabelRect = [self.textLabel.text boundingRectWithSize:contentViewSize
                                                                     options:NSStringDrawingUsesLineFragmentOrigin
                                                                  attributes:@{NSFontAttributeName:self.textLabel.font,
                                                                               NSParagraphStyleAttributeName: paragraphStyle
}
                                                                 context:nil];

0 个答案:

没有答案