'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:

解决方法:

NSString *myText = @"xxxxx";

CGSize mySize =[myText sizeWithFont:myFont constrainedToSize:CGSizeMake(200,100)];

改写成:

CGSize mySize = [myText boundingRectWithSize:CGSizeMake(200,100) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:myFont} context:nil].size;

'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:

时间: 2024-12-13 15:10:44

'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:的相关文章

iOS一个'initWithRequest:delegate:' is deprecated: first deprecated in iOS 9.0 - Use NSURLSession (see NSURLSession.h) Warning引发的思考

Warning 如上图所示 源代码片段为 - (void)loadWebRequest:(id)sender { NSURL *url=[NSURL URLWithString:@"http://localhost:8080/getAllStudent"]; NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"GET"]; NS

iOS---stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead,

旧方法 NSString *encoded = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; iOS9  之后的   新方法 //    NSString *encoded = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; //      [NS

解决interfaceOrientation is deprecated:first deprecated in ios8.0

使用他人代码中出现下面的警告,需要将该方法改为如下所示: interfaceOrientation is deprecated:first deprecated in ios8.0 [[UIApplication sharedApplication] statusBarOrientation]

iOS 6.0中UIViewController被弃用的一些方法

郝萌主倾心贡献,尊重作者的劳动成果,请勿转载. 如果文章对您有所帮助,欢迎给作者捐赠,支持郝萌主,捐赠数额随意,重在心意^_^ 我要捐赠: 点击捐赠 Cocos2d-X源码下载:点我传送 概念:deprecated 弃用.表示已不被建议使用,可能随时取消它:建议采用新的来替代. "modalViewController" 属性 is deprecated : first deprecated in iOS 6.0 而采用 presentedViewController "di

IOS BLE4.0蓝牙和外设连接和收发数据的流程

前言: 苹果在IOS 6系统之后开始支持BLE 4.0,iPhone4s,iPod 5,iPad 3等之后的机型开始内嵌BLE4.0硬件,因此在开发前请先确认你的开发环境符合上述要求,并且苹果在BLE4.0之后,对外部的连接设备已经不在需要MFI认证了,当然你的外设肯定得要有蓝牙4.0模块了 综述: 开发BLE4.0的App,你需要在你的项目里面导入框架: CoreBluetooth.framework 在需要使用到蓝牙的文件里面你需要导入头文件: #import <CoreBluetooth/

关于iOS10 Xcode8真机测试项目出现的问题 &quot;code signing is required for product type &#39;xxxxx&#39; in SDK &#39;iOS 10.0&quot;..

昨天用真机测试项目出现这样的错误,在网上搜集了一些信息,所以将自己的经验分享出来帮助更多的人. 第一步: 检查你的1和2是否填写正确,如果你是运行别人的项目,BundleIdentifier要和你的Xcode之前填写的要一致,例如,我之前填写的com.baidu.xxxx,但是我真机测试的是com.alibaba.xxx,这样就不一致了,可能会导致错误 第二步: 在Bulid Setting 中找到Singning, 在3处,你可能会看到自己的开发者账号,不要选!!,还有下面 4 Develop

视频播放 iOS8.0 与iOS 9.0

#import "ViewController.h" #import <AVFoundation/AVFoundation.h> #import <AVKit/AVKit.h> #import <MediaPlayer/MediaPlayer.h> @interface ViewController () @property(nonatomic ,strong)MPMoviePlayerController * PlayerController; @

iOS 9.3 到 iOS 10.0 的开发API不同点

iOS 9.3 to iOS 10.0 API Differences Objective-C /usr/include Accelerate AudioToolbox AudioUnit AVFoundation AVKit CallKit (Added) CFNetwork CloudKit Contacts CoreBluetooth CoreData CoreFoundation CoreGraphics CoreImage CoreLocation CoreMedia CoreMoti

embedded dylibs/frameworks are only supported on iOS 8.0 and later 错误解决

ld: warning: embedded dylibs/frameworks only run on iOS 8 or later ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later (@rpath/XXX.framework/XXX) for architecture armv7 clang: error: linker command failed with exit code 1 (use -v t