deprecated! deprecated!

Presenter Notes

非推奨となったメソッド

  • iOS6-7あたりで非推奨となったメソッドやプロパティ

use is deprecated for this architecture #raspberrypi #raspbian #linux #retinatattoo

Presenter Notes

dealloc

  • dealloc を使いましょう
- (void)viewWillUnload NS_DEPRECATED_IOS(5_0,6_0);
- (void)viewDidUnload NS_DEPRECATED_IOS(3_0,6_0); // Called after the view controller's view is released and set to nil. For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc.

Presenter Notes

modal view

  • @property(nonatomic,readonly) UIViewController *presentedViewController を使いましょう
// This property has been replaced by presentedViewController.
@property(nonatomic,readonly) UIViewController *modalViewController NS_DEPRECATED_IOS(2_0, 6_0);

Presenter Notes

display/dismiss modal

  • それぞれ complete 付きの方を使いましょう
// Display another view controller as a modal child. Uses a vertical sheet transition if animated.This method has been replaced by presentViewController:animated:completion:
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);

// Dismiss the current modal child. Uses a vertical sheet transition if animated. This method has been replaced by dismissViewControllerAnimated:completion:
- (void)dismissModalViewControllerAnimated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);

Presenter Notes

replace

replace
[self\s+dismissModalViewControllerAnimated:(YES|NO)\];
to:
[self dismissViewControllerAnimated:$1 completion:nil];

replace: 
\[self\s+presentModalViewController:(\w+)\s+animated:(YES|NO)\];
to:
[self presentViewController:$1 animated:$2 completion:nil];

Presenter Notes

UIStatuBar

typedef NS_ENUM(NSInteger, UIStatusBarStyle) {
    UIStatusBarStyleDefault                                     = 0, // Dark content, for use on light backgrounds
    UIStatusBarStyleLightContent     NS_ENUM_AVAILABLE_IOS(7_0) = 1, // Light content, for use on dark backgrounds

    UIStatusBarStyleBlackTranslucent NS_ENUM_DEPRECATED_IOS(2_0, 7_0, "Use UIStatusBarStyleLightContent") = 1,
    UIStatusBarStyleBlackOpaque      NS_ENUM_DEPRECATED_IOS(2_0, 7_0, "Use UIStatusBarStyleLightContent") = 2,
};

Presenter Notes

UIBarStyle

  • StatusBarと同じ
typedef NS_ENUM(NSInteger, UIBarStyle) {
    UIBarStyleDefault          = 0,
    UIBarStyleBlack            = 1,

    UIBarStyleBlackOpaque      = 1, // Deprecated. Use UIBarStyleBlack
    UIBarStyleBlackTranslucent = 2, // Deprecated. Use UIBarStyleBlack and set the translucent property to YES
};

Presenter Notes

UIButton

  • deprecated属性はついてないけど、UIButtonTypeRoundedRect はなくなりました
UIButtonTypeRoundedRect = UIButtonTypeSystem,   // Deprecated, use UIButtonTypeSystem instead

Presenter Notes

UIFont

  • minimumScaleFactor を使う
@property(nonatomic) CGFloat minimumFontSize NS_DEPRECATED_IOS(2_0, 6_0); // NOTE: deprecated - use minimumScaleFactor. default is 0.0

Presenter Notes

NSString

  • UILineBreakMode
    • NSLineBreakMode へ移行
  • UITextAlignment
    • NSTextAlignment へ移行

fontを使うやつは NSAttributedString を使うものへ移行

sizeWithFont:
drawAtPoint:withFont:
sizeWithFont:
drawInRect:withFont:

Presenter Notes

Use deprecated

  • Availble Xcode5(iOS 7 SDK)
  • 自分で非推奨属性をつける
@interface LegacyClass : NSObject
- (void)attendDeathMarch __deprecated_msg("this is deprecated");
@end

Presenter Notes

Presenter Notes