is deprecated编译警告warning处理

iOS6.0后,类似xxxFunction is deprecated编译警告warning处理。

By   aries4u  | 2014年5月13日 

最近在把一个iOS5.0的老项目升级到iOS7.1,发现在iOS6.0的时候,就有一些函数和枚举值被废弃。

那么在做版本兼容的时候,我们可以使用respondsToSelector这个函数,具体怎么使用就不多说了。

iOS6.0以下版本的函数、枚举(红色表示iOS6.0以上可用)

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_AVAILABLE_IOS(5_0);

 

- (void)dismissModalViewControllerAnimated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);

- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion NS_AVAILABLE_IOS(5_0);

 

 

typedef NS_ENUM(NSInteger, UILineBreakMode) {

    UILineBreakModeWordWrap = 0,            // Wrap at word boundaries

    UILineBreakModeCharacterWrap,           // Wrap at character boundaries

    UILineBreakModeClip,                    // Simply clip when it hits the end of the rect

    UILineBreakModeHeadTruncation,          // Truncate at head of line: "…wxyz". Will truncate multiline text on first line

    UILineBreakModeTailTruncation,          // Truncate at tail of line: "abcd…". Will truncate multiline text on last line

    UILineBreakModeMiddleTruncation,        // Truncate middle of line:  "ab…yz". Will truncate multiline text in the middle

} NS_DEPRECATED_IOS(2_0,6_0);

 

 

typedef NS_ENUM(NSInteger, NSLineBreakMode) {        /* What to do with long lines */

    NSLineBreakByWordWrapping = 0,         /* Wrap at word boundaries, default */

    NSLineBreakByCharWrapping,        /* Wrap at character boundaries */

    NSLineBreakByClipping,        /* Simply clip */

    NSLineBreakByTruncatingHead,    /* Truncate at head of line: "…wxyz" */

    NSLineBreakByTruncatingTail,    /* Truncate at tail of line: "abcd…" */

    NSLineBreakByTruncatingMiddle    /* Truncate middle of line:  "ab…yz" */

} NS_ENUM_AVAILABLE_IOS(6_0);

 

// Deprecated: use NSTextAlignment enum in UIKit/NSText.h

typedef NS_ENUM(NSInteger, UITextAlignment) {

    UITextAlignmentLeft = 0,

    UITextAlignmentCenter,

    UITextAlignmentRight,                   // could add justified in future

} NS_DEPRECATED_IOS(2_0,6_0);

 

/* Values for NSTextAlignment */

typedef NS_ENUM(NSInteger, NSTextAlignment) {

    NSTextAlignmentLeft      = 0,    // Visually left aligned

#if TARGET_OS_IPHONE

    NSTextAlignmentCenter    = 1,    // Visually centered

    NSTextAlignmentRight     = 2,    // Visually right aligned

#else /* !TARGET_OS_IPHONE */

    NSTextAlignmentRight     = 1,    // Visually right aligned

    NSTextAlignmentCenter    = 2,    // Visually centered

#endif

    NSTextAlignmentJustified = 3,    // Fully-justified. The last line in a paragraph is natural-aligned.

    NSTextAlignmentNatural   = 4,    // Indicates the default alignment for script

} NS_ENUM_AVAILABLE_IOS(6_0);

Category: iOS开发
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值