modalPresentationStyle屬性必須在presentViewController:
以前賦值, 不然無效....html
HandOutMoneyVc *handMoney = [[HandOutMoneyVc alloc] init]; //關鍵語句,必須有 if ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) { nextVC.modalPresentationStyle=UIModalPresentationOverCurrentContext; //iOS8以上 }else{ self.modalPresentationStyle = UIModalPresentationCurrentContext; // iOS7平臺 } [self.navigationController presentViewController:handMoney animated:YES completion:nil];
// These notifications are sent out after the equivalent delegate message is called //應用已經進入後臺 UIKIT_EXTERN NSString *const UIApplicationDidEnterBackgroundNotification NS_AVAILABLE_IOS(4_0); //應用將要進入前臺 UIKIT_EXTERN NSString *const UIApplicationWillEnterForegroundNotification NS_AVAILABLE_IOS(4_0); //應用運行成功 UIKIT_EXTERN NSString *const UIApplicationDidFinishLaunchingNotification; UIKIT_EXTERN NSString *const UIApplicationDidBecomeActiveNotification; UIKIT_EXTERN NSString *const UIApplicationWillResignActiveNotification; //收到內存警告 UIKIT_EXTERN NSString *const UIApplicationDidReceiveMemoryWarningNotification;
automaticallyAdjustsScrollViewInsets根據按所在界面的status bar,navigationbar,與tabbar的高度,自動調整scrollview的 inset,設置爲no,不讓viewController調整,咱們本身修改佈局便可。ide
NSValue能夠用來存儲任意數據類型, 包括數字,結構體等數據類型; NSNumber是NSValue的子類, 是專門用來處理數字的一個類; NSDecimalNumber是NSNumber的子類, 提供了一些基本的算術運算功能.佈局
NSDecimal提供的一些類方法:ui
+ (NSDecimalNumber *)zero; + (NSDecimalNumber *)one; + (NSDecimalNumber *)minimumDecimalNumber; + (NSDecimalNumber *)maximumDecimalNumber; + (NSDecimalNumber *)notANumber; - (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)decimalNumber withBehavior:(nullable id <NSDecimalNumberBehaviors>)behavior; - (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber withBehavior:(nullable id <NSDecimalNumberBehaviors>)behavior; - (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)decimalNumber withBehavior:(nullable id <NSDecimalNumberBehaviors>)behavior; - (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)decimalNumber withBehavior:(nullable id <NSDecimalNumberBehaviors>)behavior; - (NSDecimalNumber *)decimalNumberByRaisingToPower:(NSUInteger)power; - (NSDecimalNumber *)decimalNumberByRaisingToPower:(NSUInteger)power withBehavior:(nullable id <NSDecimalNumberBehaviors>)behavior; - (NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power; - (NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power withBehavior:(nullable id <NSDecimalNumberBehaviors>)behavior;
if (self.presentingViewController) { [self dismissViewControllerAnimated:YES completion:nil]; } else { [self.navigationController popViewControllerAnimated:YES]; }
typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleWidth = 1 << 1, UIViewAutoresizingFlexibleRightMargin = 1 << 2, UIViewAutoresizingFlexibleTopMargin = 1 << 3, UIViewAutoresizingFlexibleHeight = 1 << 4, UIViewAutoresizingFlexibleBottomMargin = 1 << 5 };
其它的組合相似。atom
摘自:http://www.cnblogs.com/jiangyazhou/archive/2012/06/26/2563041.htmlcode
簡單的說, 就是是否會回彈的效果, 相關屬性以下所示, 必須bounces爲YES時候, 下面的兩個屬性纔有效.htm
@property(nonatomic) BOOL bounces; // default YES. if YES, bounces past edge of content and back again @property(nonatomic) BOOL alwaysBounceVertical; // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag vertically @property(nonatomic) BOOL alwaysBounceHorizontal; // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag horizontally
以下所示, getter=isAutomaticallyChangeAlpha
, 這樣的聲明, 若是進行了這樣的聲明, 那麼調用get方法須要調用 isAutomaticallyChangeAlpha
便可. 這麼作是爲了增長程序的可讀性. 從新指定屬性的getter或者setter方法blog
@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;
使用:ip
- (void)willMoveToSuperview:(UIView *)newSuperview { [super willMoveToSuperview:newSuperview]; NSLog(@"oldSuperview=%@,newSuperview=%@",self.oldSuperview,newSuperview); self.oldSuperview = newSuperview; NSLog(@"%s",__func__); }
廢話很少說, 如下是蘋果提供的API:內存
// // UIActivityIndicatorView.h // UIKit // // Copyright (c) 2005-2015 Apple Inc. All rights reserved. // #import <UIKit/UIView.h> #import <UIKit/UIKitDefines.h> NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) { UIActivityIndicatorViewStyleWhiteLarge, UIActivityIndicatorViewStyleWhite, UIActivityIndicatorViewStyleGray __TVOS_PROHIBITED, }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIActivityIndicatorView : UIView <NSCoding> - (instancetype)initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style NS_DESIGNATED_INITIALIZER; // sizes the view according to the style - (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; - (instancetype) initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; @property(nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; // default is UIActivityIndicatorViewStyleWhite @property(nonatomic) BOOL hidesWhenStopped; // default is YES. calls -setHidden when animating gets set to NO @property (nullable, readwrite, nonatomic, strong) UIColor *color NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (void)startAnimating; - (void)stopAnimating; - (BOOL)isAnimating; @end NS_ASSUME_NONNULL_END