你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> UIView全部API的學習。

UIView全部API的學習。

編輯:關於IOS

/********* UIView是iOS系統界面元素的基礎,所有的界面元素都是集成自它。它本身完全是由CoreAnimation來實現的。它真正的繪圖部分,是一個叫CALayer(Core Animation Layer)的類來管理的。UIView本身,更像是一個CALayer的管理器
,訪問它的跟繪圖和跟坐標有關的屬性,例如frame,bounds等等,實際上內部都是在訪問它所包含的CALayer的相關屬性
*********/

//1.View設置動畫塊中的動畫屬性變化的曲線

typedef
NS_ENUM(NSInteger, UIViewAnimationCurve) {

UIViewAnimationCurveEaseInOut,
// slow at beginning and end

UIViewAnimationCurveEaseIn,
// slow at beginning

UIViewAnimationCurveEaseOut,
// slow at end

UIViewAnimationCurveLinear

};

//2.View內部內容不同顯示類型效果

typedef
NS_ENUM(NSInteger, UIViewContentMode) {

UIViewContentModeScaleToFill,

UIViewContentModeScaleAspectFit,      // contents scaled to fit with fixed aspect. remainder is transparent

UIViewContentModeScaleAspectFill,     // contents scaled to fill with fixed aspect. some portion of content may be clipped.

UIViewContentModeRedraw,              // redraw on bounds change (calls -setNeedsDisplay)

UIViewContentModeCenter,              // contents remain same size. positioned adjusted.

UIViewContentModeTop,

UIViewContentModeBottom,

UIViewContentModeLeft,

UIViewContentModeRight,

UIViewContentModeTopLeft,

UIViewContentModeTopRight,

UIViewContentModeBottomLeft,

UIViewContentModeBottomRight,

};

//3.五種動畫效果

typedef
NS_ENUM(NSInteger, UIViewAnimationTransition) {

UIViewAnimationTransitionNone,
沒有動畫

UIViewAnimationTransitionFlipFromLeft,
從左向右旋轉翻頁

UIViewAnimationTransitionFlipFromRight,從右向左旋轉翻頁

UIViewAnimationTransitionCurlUp,
卷曲翻頁,從下往上

UIViewAnimationTransitionCurlDown,
卷曲翻頁
從上往下

};

//4.這些屬性是為了自動調整子控件與父控件中間的位置,寬高

typedef
NS_OPTIONS(NSUInteger, UIViewAutoresizing) {

UIViewAutoresizingNone                 =
0,
不自動調整

UIViewAutoresizingFlexibleLeftMargin   =
1 << 0,自動調整與superView左邊的距離,保證與superView左邊的距離不變

UIViewAutoresizingFlexibleWidth        =
1 << 1,自動調整自己的寬度,保證與superView左邊和右邊的距離不變

UIViewAutoresizingFlexibleRightMargin  =
1 << 2,自動調整與superView的右邊距離,保證與superView左邊的距離不變

UIViewAutoresizingFlexibleTopMargin    =
1 << 3,自動調整與superView頂部的距離,保證與superView底部的距離不變

UIViewAutoresizingFlexibleHeight       =
1 << 4,自動調整自己的高度,保證與superView左邊和郵編的距離不變

UIViewAutoresizingFlexibleBottomMargin =
1 << 5,自動調整與superView底部的距離,保證與superView頂部的距離不變

};

//4.關於動畫Option的一些可選項

typedef
NS_OPTIONS(NSUInteger, UIViewAnimationOptions) {

UIViewAnimationOptionLayoutSubviews            =
1 <<  0,
提交動畫的時候布局子控件,表示子控件將和父控件一同動畫

UIViewAnimationOptionAllowUserInteraction      =
1 <<  1,
動畫時允許用戶交流,比如觸摸

UIViewAnimationOptionBeginFromCurrentState     =
1 <<  2,
從當前狀態開始動畫

UIViewAnimationOptionRepeat                    =
1 <<  3,
動畫無限重復

UIViewAnimationOptionAutoreverse               =
1 <<  4,
執行動畫回路,前提是設置動畫無限重復

UIViewAnimationOptionOverrideInheritedDuration =
1 <<  5,
忽略外層動畫嵌套的執行時間

UIViewAnimationOptionOverrideInheritedCurve    =
1 <<  6,
忽略外層動畫嵌套的時間變化曲線

UIViewAnimationOptionAllowAnimatedContent      =
1 <<  7,
通過改變屬性和重回實現動畫效果,如果key沒有提交動畫將使用快照

UIViewAnimationOptionShowHideTransitionViews   =
1 <<  8,
用顯隱的方式替代添加移除圖層的動畫效果

UIViewAnimationOptionOverrideInheritedOptions  =
1 <<  9,
忽略嵌套繼承的選項

 

UIViewAnimationOptionCurveEaseInOut            =
0 << 16,
時間曲線函數,由慢到快

UIViewAnimationOptionCurveEaseIn               =
1 << 16,
時間曲線函數,由慢到特別快

UIViewAnimationOptionCurveEaseOut              =
2 << 16,
時間曲線函數,由快到慢

UIViewAnimationOptionCurveLinear               =
3 << 16,
時間曲線函數,勻速

 

UIViewAnimationOptionTransitionNone            =
0 << 20,
無轉場動畫

UIViewAnimationOptionTransitionFlipFromLeft    =
1 << 20,
轉場從左翻轉

UIViewAnimationOptionTransitionFlipFromRight   =
2 << 20,
轉場從右翻轉

UIViewAnimationOptionTransitionCurlUp          =
3 << 20,
上卷轉場

UIViewAnimationOptionTransitionCurlDown        =
4 << 20,
下卷轉場

UIViewAnimationOptionTransitionCrossDissolve   =
5 << 20,
轉場交叉消失

UIViewAnimationOptionTransitionFlipFromTop     =
6 << 20,
轉場上下翻轉

UIViewAnimationOptionTransitionFlipFromBottom  =
7 << 20,
轉場從下翻轉

} NS_ENUM_AVAILABLE_IOS(4_0);

//5.關鍵幀動畫的選項參數設置

typedef
NS_OPTIONS(NSUInteger, UIViewKeyframeAnimationOptions) {

UIViewKeyframeAnimationOptionLayoutSubviews            =
UIViewAnimationOptionLayoutSubviews,

UIViewKeyframeAnimationOptionAllowUserInteraction      =
UIViewAnimationOptionAllowUserInteraction,
// turn on user interaction while animating

UIViewKeyframeAnimationOptionBeginFromCurrentState     =
UIViewAnimationOptionBeginFromCurrentState,
// start all views from current value, not initial value

UIViewKeyframeAnimationOptionRepeat                    =
UIViewAnimationOptionRepeat,
// repeat animation indefinitely

UIViewKeyframeAnimationOptionAutoreverse               =
UIViewAnimationOptionAutoreverse,
// if repeat, run animation back and forth

UIViewKeyframeAnimationOptionOverrideInheritedDuration =
UIViewAnimationOptionOverrideInheritedDuration,
// ignore nested duration

UIViewKeyframeAnimationOptionOverrideInheritedOptions  =
UIViewAnimationOptionOverrideInheritedOptions,
// do not inherit any options or animation type

 

UIViewKeyframeAnimationOptionCalculationModeLinear     =
0 << 10,
// default

UIViewKeyframeAnimationOptionCalculationModeDiscrete   =
1 << 10,

UIViewKeyframeAnimationOptionCalculationModePaced      =
2 << 10,

UIViewKeyframeAnimationOptionCalculationModeCubic      =
3 << 10,

UIViewKeyframeAnimationOptionCalculationModeCubicPaced =
4 << 10

} NS_ENUM_AVAILABLE_IOS(7_0);

typedef
NS_ENUM(NSUInteger, UISystemAnimation) {

UISystemAnimationDelete,    // removes the views from the hierarchy when complete

} NS_ENUM_AVAILABLE_IOS(7_0);

typedef
NS_ENUM(NSInteger, UIViewTintAdjustmentMode) {

UIViewTintAdjustmentModeAutomatic,

 

UIViewTintAdjustmentModeNormal,

UIViewTintAdjustmentModeDimmed,

} NS_ENUM_AVAILABLE_IOS(7_0);

 

@protocol UICoordinateSpace <NSObject>

- (CGPoint)convertPoint:(CGPoint)point toCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace
NS_AVAILABLE_IOS(8_0);

- (CGPoint)convertPoint:(CGPoint)point fromCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace
NS_AVAILABLE_IOS(8_0);

- (CGRect)convertRect:(CGRect)rect toCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace
NS_AVAILABLE_IOS(8_0);

- (CGRect)convertRect:(CGRect)rect fromCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace
NS_AVAILABLE_IOS(8_0);

 

@property (readonly,
nonatomic) CGRect bounds
NS_AVAILABLE_IOS(8_0);

@end

 

@classUIBezierPath,
UIEvent, UIWindow,
UIViewController, UIColor,
UIGestureRecognizer, UIMotionEffect,
CALayer;

NS_CLASS_AVAILABLE_IOS(2_0)
@interface UIView :
UIResponder <NSCoding,
UIAppearance, UIAppearanceContainer,
UIDynamicItem, UITraitEnvironment,
UICoordinateSpace> {

@package
CALayer        *_layer;
id              _gestureInfo;
NSMutableArray *_gestureRecognizers;
NSArray        *_subviewCache;
float           _charge;
NSInteger       _tag;
UIViewController *_viewDelegate;
NSString         *_backgroundColorSystemColorName;
NSUInteger      _countOfMotionEffectsInSubtree;
struct {
unsigned int userInteractionDisabled:1;
unsigned int implementsDrawRect:1;
unsigned int implementsDidScroll:1;
unsigned int implementsMouseTracking:1;
unsigned int implementsIntrinsicContentSize:1;
unsigned int hasBackgroundColor:1;
unsigned int isOpaque:1;
unsigned int becomeFirstResponderWhenCapable:1;
unsigned int interceptMouseEvent:1;
unsigned int deallocating:1;
unsigned int debugFlash:1;
unsigned int debugSkippedSetNeedsDisplay:1;
unsigned int debugScheduledDisplayIsRequired:1;
unsigned int isInAWindow:1;
unsigned int isAncestorOfFirstResponder:1;
unsigned int dontAutoresizeSubviews:1;
unsigned int autoresizeMask:6;
unsigned int patternBackground:1;
unsigned int fixedBackgroundPattern:1;
unsigned int dontAnimate:1;
unsigned int superLayerIsView:1;
unsigned int layerKitPatternDrawing:1;
unsigned int multipleTouchEnabled:1;
unsigned int exclusiveTouch:1;
unsigned int hasViewController:1;
unsigned int needsDidAppearOrDisappear:1;
unsigned int gesturesEnabled:1;
unsigned int deliversTouchesForGesturesToSuperview:1;
unsigned int chargeEnabled:1;
unsigned int skipsSubviewEnumeration:1;
unsigned int needsDisplayOnBoundsChange:1;
unsigned int hasTiledLayer:1;
unsigned int hasLargeContent:1;
unsigned int unused:1;
unsigned int traversalMark:1;
unsigned int appearanceIsInvalid:1;
unsigned int monitorsSubtree:1;
unsigned int hostsAutolayoutEngine:1;
unsigned int constraintsAreClean:1;
unsigned int subviewLayoutConstraintsAreClean:1;
unsigned int intrinsicContentSizeConstraintsAreClean:1;
unsigned int potentiallyHasDanglyConstraints:1;
unsigned int doesNotTranslateAutoresizingMaskIntoConstraints:1;
unsigned int autolayoutIsClean:1;
unsigned int layoutFlushingDisabled:1;
unsigned int layingOutFromConstraints:1;
unsigned int wantsAutolayout:1;
unsigned int subviewWantsAutolayout:1;
unsigned int isApplyingValuesFromEngine:1;
unsigned int isInAutolayout:1;
unsigned int isSubviewUpdatingAutoresizingConstraints:1;
unsigned int isUpdatingConstraints:1;
unsigned int isHostingUpdateConstraintsPassDuringLayout:1;
unsigned int isRunningEngineLevelConstraintsPass:1;
unsigned int isUnsatisfiableConstraintsLoggingSuspended:1;
unsigned int systemLayoutFittingSizeNeedsUpdate:1;
unsigned int systemLayoutFittingSizeNeedsUpdateInWholeSubtree:1;
unsigned int isCalculatingSystemLayoutFittingSize:1;
unsigned int stayHiddenAwaitingReuse:1;
unsigned int stayHiddenAfterReuse:1;
unsigned int skippedLayoutWhileHiddenForReuse:1;
unsigned int hasMaskView:1;
unsigned int hasVisualAltitude:1;
unsigned int hasBackdropMaskViews:1;
unsigned int backdropMaskViewFlags:5;
unsigned int delaysTouchesForSystemGestures:1;
unsigned int subclassShouldDelayTouchForSystemGestures:1;
unsigned int hasMotionEffects:1;
unsigned int backdropOverlayMode:2;
unsigned int tintAdjustmentMode:2;
unsigned int isReferenceView:1;
unsigned int focusState:2;
unsigned int hasUserInterfaceIdiom:1;
unsigned int userInterfaceIdiom:3;
unsigned int ancestorDefinesTintColor:1;
unsigned int ancestorDefinesTintAdjustmentMode:1;
unsigned int needsTraitCollectionDidChange:1;
unsigned int coloredViewBounds:1;
unsigned int coloredAlignmentRects:1;
unsigned int preservesSuperviewMargins:1;
unsigned int hasGeometryObservers:1;
unsigned int wantsGeometryChanges:1;

} _viewFlags;

}

//6.UIView有個layer屬性,可以返回它的主CALayer實例,UIView有一個layerClass方法,返回主layer所使用的類,UIView的子類,可以通過重載這個方法,來讓UIView使用不同的CALayer來顯示。

+ (Class)layerClass;                        // default is [CALayer class]. Used when creating the underlying layer for the view.

//7.初始化View並設置frame大小

- (instancetype)initWithFrame:(CGRect)frame;
// default initializer

//8.這個屬性設置view是否支持觸摸點擊

@property(nonatomic,getter=isUserInteractionEnabled)
BOOL userInteractionEnabled;
// default is YES. if set to NO, user events (touch, keys) are ignored and removed from the event queue.

//9.給view添加tag標簽

@property(nonatomic)
NSInteger tag;
// default is 0

//10.view的layer屬性

@property(nonatomic,readonly,retain)
CALayer  *layer;
// returns view's layer. Will always return a non-nil value. view is layer's delegate

 

@end

 

@interface UIView(UIViewGeometry)

 

//11.位置和尺寸 以父控件的左上角為原點

@property(nonatomic)
CGRect            frame;

//12.位置和尺寸
以自己的左上角為原點

@property(nonatomic)
CGRect            bounds;
// default bounds is zero origin, frame size. animatable

//13.中點
以父控件的左上角為原點

@property(nonatomic)
CGPoint           center;
// center is center of frame. animatable

//14.形變屬性
縮放 旋轉

@property(nonatomic)
CGAffineTransform transform;
// default is CGAffineTransformIdentity. animatable

@property(nonatomic)
CGFloat           contentScaleFactor
NS_AVAILABLE_IOS(4_0);

//15.返回值決定是否支持多點觸摸

@property(nonatomic,getter=isMultipleTouchEnabled)
BOOL multipleTouchEnabled;
// default is NO

//16.如果設置為YES則當前UIView會毒戰整個Touch事件。具體來說就是如果UIView設置了exclusiveTouch屬性為YES則當這個UIView成為第一響應者時,在手指離開屏幕前其他view不會相應任何touch事件。

@property(nonatomic,getter=isExclusiveTouch)
BOOL       exclusiveTouch;
// default is NO

//17.當在一個view上添加一個屏幕罩時,但又不影響對下面view的操作,也就是可以通過屏幕罩對下面的view進行操作。

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent
*)event;   // recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system

//18.這個函數的用處是判斷當前的點擊或者觸摸事件的點是否在當前的view中。

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;
// default returns YES if point is in bounds

//19.轉換一個點從接受者坐標系到給定視圖坐標系

- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;

//20.把一個點從一個坐標系轉換到接收者的坐標系

- (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view;

//21.轉換接收者坐標系中的矩形到其他視圖

- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view;

//22.轉換一個矩形從其他視圖坐標系到接收者坐標系

- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view;

//23.如果某個視圖的這個屬性被設置為YES,則其子視圖會根據autoresizingMask屬性的值自動進行尺寸調整,簡單配置一下視圖的自動尺寸調整掩碼常常就能使應用程序得到合適的行為。否則,應用程序就必須通過重載layoutSubviews方法來提供自己的實現

@property(nonatomic)
BOOL               autoresizesSubviews;

//24.自動調整子控件與父控件中間的位置,寬高

@property(nonatomic)
UIViewAutoresizing autoresizingMask;
// simple resize. default is UIViewAutoresizingNone

//25.這個方法會計算並且返回一個最適應接收子視圖的大小

- (CGSize)sizeThatFits:(CGSize)size;
// return 'best' size to fit given size. does not actually resize view. Default is return existing view size

//26.移動並且調整子視圖的大小

- (void)sizeToFit;
// calls sizeThatFits: with current view bounds and changes bounds size.

@end

 

@interface UIView(UIViewHierarchy)

//27.取到父view

@property(nonatomic,readonly)
UIView       *superview;

//28.取到view的子view

@property(nonatomic,readonly,copy)
NSArray *subviews;

//29.屏幕窗口

@property(nonatomic,readonly)
UIWindow     *window;

//30.把當前視圖從它的父v視圖中移除

- (void)removeFromSuperview;

//31.在視圖中插入一個屬兔,並且可以設置索引值

- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;

//32.交換指定位置的兩個視圖的位置

- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;

//33.增加一個子視圖控件,新添加的控件默認都是在subviews數組的後面,也就是默認顯示在最上面

- (void)addSubview:(UIView *)view;

//34.增加一個子控件,插入到siblingSubview的下面

- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;

//35.增加一個子控件,插入到siblingSubview的上面

- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;

//36.將一個指定的控件拖動到最上面來顯示

- (void)bringSubviewToFront:(UIView *)view;

//37.將一個指定的控件拖動到最下面來顯示

- (void)sendSubviewToBack:(UIView *)view;

//38.告訴視圖
子視圖已經添加,默認不執行任何操作,子類可以重寫

- (void)didAddSubview:(UIView *)subview;

//39.通知視圖某個子視圖即將被移除,默認不執行任何操作,子類可以重寫

- (void)willRemoveSubview:(UIView *)subview;

//40.通知即將移動到新的父視圖中

- (void)willMoveToSuperview:(UIView *)newSuperview;

//41.通知已經移動到新的父視圖

- (void)didMoveToSuperview;

//42.通知即將已移動到新的創樓

- (void)willMoveToWindow:(UIWindow *)newWindow;

//43.通知已經移動到新的窗口

- (void)didMoveToWindow;

//44.返回一個布爾值 盤都某個視圖是不是view的子控件或者子控件的子控件

- (BOOL)isDescendantOfView:(UIView *)view;
// returns YES for self.

//45.通過tag獲得對應tag的子控件

- (UIView *)viewWithTag:(NSInteger)tag;
// recursive search. includes self

 

// Allows you to perform layout before the drawing cycle happens. -layoutIfNeeded forces layout early

//46.在對現在有布局有調整更改後,使用這個方法進行更新

- (void)setNeedsLayout;

//47.強制進行更新layout,通常與上面的方法結合一塊使用

- (void)layoutIfNeeded;

//48.一般寫在view內部,當控件的大小約束發生變化的時候在這裡重寫布局子控件的位置和尺寸,一般在這個方法裡面或者視圖的frame是最准確的

- (void)layoutSubviews;
// override point. called by layoutIfNeeded automatically. As of iOS 6.0, when constraints-based layout is used the base implementation applies the constraints-based layout, otherwise it does nothing.

 

/*

-layoutMargins returns a set of insets from the edge of the view's bounds that denote a default spacing for laying out content.

If preservesSuperviewLayoutMargins is YES, margins cascade down the view tree, adjusting for geometry offsets, so that setting the left value of layoutMargins on a superview will affect the left value of layoutMargins for subviews positioned close to the left
edge of their superview's bounds

If your view subclass uses layoutMargins in its layout or drawing, override -layoutMarginsDidChange in order to refresh your view if the margins change.

*/

//49.iOS8的新特性,我們可以用這個屬性去定義view之間的間距,該屬性只對autolayout布局有效。

@property (nonatomic)
UIEdgeInsets layoutMargins
NS_AVAILABLE_IOS(8_0);

//50. preservesSuperviewLayoutMargins這個屬性默認是NO,如果把它設為YES,layoutMargins會根據屏幕中相關view的布局而改變。

@property (nonatomic)
BOOL preservesSuperviewLayoutMargins
NS_AVAILABLE_IOS(8_0);
// default is NO - set to enable pass-through or cascading behavior of margins from this view’s parent to its children

//51.在我們改變view的layoutMargins這個屬性時,會觸發這個方法,我們在自己的view裡面可以重寫這個方法來捕獲layoutMargins的變化。在大多數情況下,我們可以在這個方法裡面觸發drawing和layout的update。

- (void)layoutMarginsDidChange
NS_AVAILABLE_IOS(8_0);

 

@end

 

@interface UIView(UIViewRendering)

//52.如果我們想要在一個UIView中繪圖,需要寫一個擴展UIView的類,並重寫drawRect方法,在這裡進行繪圖操作。這個方法不能直接調用。蘋果要求我們調用UIView類中的setNeedsDisplay方法,則程序會自動調用drawRect方法進行重回(調用setNeedsDisplay會自動調用drawRect)

- (void)drawRect:(CGRect)rect;

//53.調用這個方法會自動調用drawRect方法

- (void)setNeedsDisplay;

//54.同上,直接調用setNeedsDisplay,或者setNeedsDisplayInRect處罰drawRect,但是有個前提條件是rect不能為0

- (void)setNeedsDisplayInRect:(CGRect)rect;

//55.當時YES的時候,如果子視圖的范圍超出了父視圖的邊界,那麼超出的部分就會被裁剪掉。

@property(nonatomic)
BOOL              clipsToBounds;
// When YES, content and subviews are clipped to the bounds of the view. Default is NO.

//56.view的背景顏色

@property(nonatomic,copy)
UIColor          *backgroundColor
UI_APPEARANCE_SELECTOR;
// default is nil. Can be useful with the appearance proxy on custom UIView subclasses.

//57.透明度

@property(nonatomic)
CGFloat           alpha;
// animatable. default is 1.0

//58.不透明度

@property(nonatomic,getter=isOpaque)
BOOL              opaque;
// default is YES. opaque views must fill their entire bounds or the results are undefined. the active CGContext in drawRect: will not have been cleared and may have non-zeroed pixels

//59.如果設置為YES,在view請求之前都會清楚current context buffer,來更新相同區域

@property(nonatomic)
BOOL              clearsContextBeforeDrawing;
// default is YES. ignored for opaque views. for non-opaque views causes the active CGContext in drawRect: to be pre-filled with transparent pixels

//60.隱藏

@property(nonatomic,getter=isHidden)
BOOL              hidden;
// default is NO. doesn't check superviews

//61.內容顯示的模式

@property(nonatomic)
UIViewContentMode contentMode;
// default is UIViewContentModeScaleToFill

//62.圖片的拉伸操作
例如

imageView.image = [UIImage
imageNamed:@"image.png"]; [imageView setContentStretch:CGRectMake(150.0/300.0,75.0/150.0,10.0/300.0,10.0/150.0)];

image.png的大小是 210.0  x  126.0

imageView的frame是(9,117,300,150);

150.0/300.0表示x軸上,前150個像素不進行拉伸。

75.0/150.0表示y軸上,前75個像素不進行拉伸。

10.0/300.0表示x軸上150後的10個像素(151-160)進行拉伸,直到image.png鋪滿imageView。

10.0/150.0表示y軸上75後的10個(76-85)像素進行拉伸,直到image.png鋪滿imageView。

@property(nonatomic)
CGRect            contentStretch
NS_DEPRECATED_IOS(3_0,6_0);
// animatable. default is unit rectangle {{0,0} {1,1}}. Now deprecated: please use -[UIImage resizableImageWithCapInsets:] to achieve the same effect.

//63.蒙板view

@property(nonatomic,retain)
UIView           *maskView
NS_AVAILABLE_IOS(8_0);

 

/*

-tintColor always returns a color. The color returned is the first non-default value in the receiver's superview chain (starting with itself).

If no non-default value is found, a system-defined color is returned.

If this view's -tintAdjustmentMode returns Dimmed, then the color that is returned for -tintColor will automatically be dimmed.

If your view subclass uses tintColor in its rendering, override -tintColorDidChange in order to refresh the rendering if the color changes.

*/

//63.這個屬性使用是改變應用程序的外觀的。默認tintColor的值為nil,這表示它將會運用父食欲層次的顏色來進行著色。如果父視圖中沒有設置tintColor,那麼默認系統就會使用藍色。因此,可以通過root view controller的tintColor來改變系統整體的顏色。

@property(nonatomic,retain)
UIColor *tintColor
NS_AVAILABLE_IOS(7_0);

 

/*

-tintAdjustmentMode always returns either UIViewTintAdjustmentModeNormal or UIViewTintAdjustmentModeDimmed. The value returned is the first non-default value in the receiver's superview chain (starting with itself).

If no non-default value is found, UIViewTintAdjustmentModeNormal is returned.

When tintAdjustmentMode has a value of UIViewTintAdjustmentModeDimmed for a view, the color it returns from tintColor will be modified to give a dimmed appearance.

When the tintAdjustmentMode of a view changes (either the view's value changing or by one of its superview's values changing), -tintColorDidChange will be called to allow the view to refresh its rendering.

*/

//64.這個屬性可以使tintColor變暗,因此整個視圖層次變暗。並且它又三個值在裡面選擇一個設置。

@property(nonatomic)
UIViewTintAdjustmentMode tintAdjustmentMode
NS_AVAILABLE_IOS(7_0);

 

/*

The -tintColorDidChange message is sent to appropriate subviews of a view when its tintColor is changed by client code or to subviews in the view hierarchy of a view whose tintColor is implicitly changed when its superview or tintAdjustmentMode changes.

*/

//65.覆蓋這個方法的目的是為了當tintColor改變的時候自定義一些行為。

- (void)tintColorDidChange
NS_AVAILABLE_IOS(7_0);

 

@end

 

@interface UIView(UIViewAnimation)

//66.開始動畫

+ (void)beginAnimations:(NSString *)animationID context:(void
*)context;  // additional context info passed to will start/did stop selectors. begin/commit can be nested

//67.提交動畫

+ (void)commitAnimations;
// starts up any animations when the top level animation is commited

//68.設置動畫代理

+ (void)setAnimationDelegate:(id)delegate;
// default = nil

//69.動畫將要開始時執行方法(必須要先設置動畫代理)

+ (void)setAnimationWillStartSelector:(SEL)selector;
// default = NULL. -animationWillStart:(NSString *)animationID context:(void *)context

//70.動畫已結束時執行方法(必須要先設置動畫代理)

+ (void)setAnimationDidStopSelector:(SEL)selector;
// default = NULL. -animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context

//71.設置動畫時長

+ (void)setAnimationDuration:(NSTimeInterval)duration;
// default = 0.2

//72.動畫延遲執行時間

+ (void)setAnimationDelay:(NSTimeInterval)delay;
// default = 0.0

//73.設置在動畫塊內部動畫屬性改變的開始時間

+ (void)setAnimationStartDate:(NSDate *)startDate;
// default = now ([NSDate date])

//74.設置動畫曲線,默認是勻速進行

+ (void)setAnimationCurve:(UIViewAnimationCurve)curve;
// default = UIViewAnimationCurveEaseInOut

//75.動畫的重復播放此時

+ (void)setAnimationRepeatCount:(float)repeatCount;
// default = 0.0.  May be fractional

//76.設置是否自定翻轉當前的動畫效果

+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses;
// default = NO. used if repeat count is non-zero

//77.設置動畫從當前狀態開始播放

+ (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState;
// default = NO. If YES, the current view position is always used for new animations -- allowing animations to "pile up" on each other. Otherwise, the last end state is used for the animation (the default).

//78.在動畫塊中為視圖設置過渡

+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView
*)view cache:(BOOL)cache;
// current limitation - only one per begin/commit block

//79.設置是否激活動畫

+ (void)setAnimationsEnabled:(BOOL)enabled;
// ignore any attribute changes while set.

//80.返回一個布爾值表示動畫是否結束

+ (BOOL)areAnimationsEnabled;

//81.先檢查動畫當前是否啟用,然後禁止動畫,執行block內的方法,最後重新啟用動畫,而且這個方法不會阻塞基於CoreAnimation的動畫

+ (void)performWithoutAnimation:(void (^)(void))actionsWithoutAnimation
NS_AVAILABLE_IOS(7_0);

 

@end

 

@interface UIView(UIViewAnimationWithBlocks)

//81.block封裝參與動畫  動畫時長 延遲時間 動畫選項條件 動畫結束的回調

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay
options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL
finished))completion NS_AVAILABLE_IOS(4_0);

//82.block封裝參與動畫 動畫時長 動畫結束的回調

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations
completion:(void (^)(BOOL finished))completion
NS_AVAILABLE_IOS(4_0);
// delay = 0.0, options = 0

//83.block封裝參與動畫  動畫時長

+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations
NS_AVAILABLE_IOS(4_0);
// delay = 0.0, options = 0, completion = NULL

 

/* Performs `animations` using a timing curve described by the motion of a spring. When `dampingRatio` is 1, the animation will smoothly decelerate to its final model values without oscillating. Damping ratios less than 1 will oscillate more and more before
coming to a complete stop. You can use the initial spring velocity to specify how fast the object at the end of the simulated spring was moving before it was attached. It's a unit coordinate system, where 1 is defined as travelling the total animation distance
in a second. So if you're changing an object's position by 200pt in this animation, and you want the animation to behave as if the object was moving at 100pt/s before the animation started, you'd pass 0.5. You'll typically want to pass 0 for the velocity.
*/

//84.

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay
usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void
(^)(void))animations completion:(void (^)(BOOL finished))completion
NS_AVAILABLE_IOS(7_0);

 

+ (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration
options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL
finished))completion NS_AVAILABLE_IOS(4_0);

 

+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration
options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion
NS_AVAILABLE_IOS(4_0);
// toView added to fromView.superview, fromView removed from its superview

 

/* Performs the requested system-provided animation on one or more views. Specify addtional animations in the parallelAnimations block. These additional animations will run alongside the system animation with the same timing and duration that the system animation
defines/inherits. Additional animations should not modify properties of the view on which the system animation is being performed. Not all system animations honor all available options.

*/

+ (void)performSystemAnimation:(UISystemAnimation)animation onViews:(NSArray
*)views options:(UIViewAnimationOptions)options animations:(void (^)(void))parallelAnimations completion:(void (^)(BOOL
finished))completion NS_AVAILABLE_IOS(7_0);

 

@end

//UIView的關鍵幀動畫

@interface UIView (UIViewKeyframeAnimations)

//84.UIView添加了一個方法用來直接使用關鍵幀動畫而不用輔助CoreAnimation來實現,這個方法需要浮點型的動畫持續時長和延遲,一些二進制組成的選項和動畫運行的block和動畫運行完後最後的block,這是一個標准的UIVIew的動畫的實現。

+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay
options:(UIViewKeyframeAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL
finished))completion NS_AVAILABLE_IOS(7_0);

//85.這個方法是用來添加動畫序列內的不動點。

+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime relativeDuration:(double)frameDuration
animations:(void (^)(void))animations
NS_AVAILABLE_IOS(7_0);
// start time and duration are values between 0.0 and 1.0 specifying time and duration relative to the overall time of the keyframe animation

@end

 

@interface UIView (UIViewGestureRecognizers)

 

@property(nonatomic,copy)
NSArray *gestureRecognizers
NS_AVAILABLE_IOS(3_2);

 

- (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer
NS_AVAILABLE_IOS(3_2);

- (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer
NS_AVAILABLE_IOS(3_2);

 

// called when the recognizer attempts to transition out of UIGestureRecognizerStatePossible if a touch hit-tested to this view will be cancelled as a result of gesture recognition

// returns YES by default. return NO to cause the gesture recognizer to transition to UIGestureRecognizerStateFailed

// subclasses may override to prevent recognition of particular gestures. for example, UISlider prevents swipes parallel to the slider that start in the thumb

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
NS_AVAILABLE_IOS(6_0);

 

@end

 

@interface UIView (UIViewMotionEffects)

 

/*! Begins applying `effect` to the receiver. The effect's emitted keyPath/value pairs will be

applied to the view's presentation layer.

 

Animates the transition to the motion effect's values using the present UIView animation

context. */

- (void)addMotionEffect:(UIMotionEffect *)effect
NS_AVAILABLE_IOS(7_0);

 

/*! Stops applying `effect` to the receiver. Any affected presentation values will animate to

their post-removal values using the present UIView animation context. */

- (void)removeMotionEffect:(UIMotionEffect *)effect
NS_AVAILABLE_IOS(7_0);

 

@property (copy,
nonatomic) NSArray *motionEffects
NS_AVAILABLE_IOS(7_0);

 

@end

 

 

//

// UIView Constraint-based Layout Support

//

 

typedef
NS_ENUM(NSInteger, UILayoutConstraintAxis) {

UILayoutConstraintAxisHorizontal =
0,

UILayoutConstraintAxisVertical =
1

};

 

// Installing Constraints

 

/* A constraint is typically installed on the closest common ancestor of the views involved in the constraint.

It is required that a constraint be installed on _a_ common ancestor of every view involved.  The numbers in a constraint are interpreted in the coordinate system of the view it is installed on.  A view is considered to be an ancestor of itself.

*/

@interface UIView (UIConstraintBasedLayoutInstallingConstraints)

//85.返回當前view中的所有constraints

- (NSArray *)constraints
NS_AVAILABLE_IOS(6_0);

//86.添加單個constraint

- (void)addConstraint:(NSLayoutConstraint *)constraint
NS_AVAILABLE_IOS(6_0);
// This method will be deprecated in a future release and should be avoided.  Instead, set NSLayoutConstraint's active property to YES.

//87.添加一組contraint

- (void)addConstraints:(NSArray *)constraints
NS_AVAILABLE_IOS(6_0);
// This method will be deprecated in a future release and should be avoided.  Instead use +[NSLayoutConstraint activateConstraints:].

//88.移除單個contraint

- (void)removeConstraint:(NSLayoutConstraint *)constraint
NS_AVAILABLE_IOS(6_0);
// This method will be deprecated in a future release and should be avoided.  Instead set NSLayoutConstraint's active property to NO.

//89.移除一組contraint

- (void)removeConstraints:(NSArray *)constraints
NS_AVAILABLE_IOS(6_0);
// This method will be deprecated in a future release and should be avoided.  Instead use +[NSLayoutConstraint deactivateConstraints:].

@end

 

// Core Layout Methods

 

/* To render a window, the following passes will occur, if necessary.

 

update constraints

layout

display

 

Please see the conceptual documentation for a discussion of these methods.

*/

 

@interface UIView (UIConstraintBasedLayoutCoreMethods)

/*******autoLayout的布局過程是update constraints(uodateContraints)->layout subviews(layoutSubviews)->display(drawRect)這三步不是單向的,如果layout的過程中改變了constraint,就會觸發update
constraints,進行新的一輪迭代。我們在實際代碼中,應該避免在此造成死循環 *******/

//90.我們可以調用這個方法觸發update Constraints的操作。在neneedsUpdateContraints返回YES時,才能成功觸發update Contraints的操作。我們不應該重寫這個方法。

- (void)updateConstraintsIfNeeded
NS_AVAILABLE_IOS(6_0);
// Updates the constraints from the bottom up for the view hierarchy rooted at the receiver. UIWindow's implementation creates a layout engine if necessary first.

//91.自定義view時,我們應該重寫這個方法來設置當前view布局的布局約束,重寫這個方法時一定要調用[super updateContraints]

- (void)updateConstraints
NS_AVAILABLE_IOS(6_0);
// Override this to adjust your special constraints during a constraints update pass

//92.布局系統使用這個返回值來確定是否調用updateContraints

- (BOOL)needsUpdateConstraints
NS_AVAILABLE_IOS(6_0);

//93.當一個自定義的view某一個屬性的改變可能影響到界面布局,我們應該調用這個方法來告訴布局系統在未來某個時刻需要更新,系統會調用updateContraints去更新布局。

- (void)setNeedsUpdateConstraints
NS_AVAILABLE_IOS(6_0);

@end

 

// Compatibility and Adoption

 

@interface UIView (UIConstraintBasedCompatibility)

 

/* by default, the autoresizing mask on a view gives rise to constraints that fully determine the view's position.  Any constraints you set on the view are likely to conflict with autoresizing constraints, so you must turn off this property first. IB will turn
it off for you.

*/

//94.我們在使用代碼來寫自己的約束布局代碼時,必須設置當前view的translatesAutoresizingMaskIntoContraints為NO,否則無法工作。

- (BOOL)translatesAutoresizingMaskIntoConstraints
NS_AVAILABLE_IOS(6_0);
// Default YES

- (void)setTranslatesAutoresizingMaskIntoConstraints:(BOOL)flag
NS_AVAILABLE_IOS(6_0);

 

/* constraint-based layout engages lazily when someone tries to use it (e.g., adds a constraint to a view).  If you do all of your constraint set up in -updateConstraints, you might never even receive updateConstraints if no one makes a constraint.  To fix
this chicken and egg problem, override this method to return YES if your view needs the window to use constraint-based layout.

*/

+ (BOOL)requiresConstraintBasedLayout
NS_AVAILABLE_IOS(6_0);

 

@end

 

// Separation of Concerns

 

@interface UIView (UIConstraintBasedLayoutLayering)

 

/* Constraints do not actually relate the frames of the views, rather they relate the "alignment rects" of views.  This is the same as the frame unless overridden by a subclass of UIView.  Alignment rects are the same as the "layout rects" shown in Interface
Builder 3.  Typically the alignment rect of a view is what the end user would think of as the bounding rect around a control, omitting ornamentation like shadows and engraving lines.  The edges of the alignment rect are what is interesting to align, not the
shadows and such.

*/

 

/* These two methods should be inverses of each other.  UIKit will call both as part of layout computation.

They may be overridden to provide arbitrary transforms between frame and alignment rect, though the two methods must be inverses of each other.

However, the default implementation uses -alignmentRectInsets, so just override that if it's applicable.  It's easier to get right.

A view that displayed an image with some ornament would typically override these, because the ornamental part of an image would scale up with the size of the frame.

Set the NSUserDefault UIViewShowAlignmentRects to YES to see alignment rects drawn.

*/

- (CGRect)alignmentRectForFrame:(CGRect)frame
NS_AVAILABLE_IOS(6_0);

- (CGRect)frameForAlignmentRect:(CGRect)alignmentRect
NS_AVAILABLE_IOS(6_0);

 

/* override this if the alignment rect is obtained from the frame by insetting each edge by a fixed amount.  This is only called by alignmentRectForFrame: and frameForAlignmentRect:.

*/

- (UIEdgeInsets)alignmentRectInsets
NS_AVAILABLE_IOS(6_0);

 

/* When you make a constraint on the NSLayoutAttributeBaseline of a view, the system aligns with the bottom of the view returned from this method. A nil return is interpreted as the receiver, and a non-nil return must be in the receiver's subtree.  UIView's
implementation returns self.

*/

- (UIView *)viewForBaselineLayout
NS_AVAILABLE_IOS(6_0);

 

 

/* Override this method to tell the layout system that there is something it doesn't natively understand in this view, and this is how large it intrinsically is.  A typical example would be a single line text field.  The layout system does not understand text
- it must just be told that there's something in the view, and that that something will take a certain amount of space if not clipped.

 

In response, UIKit will set up constraints that specify (1) that the opaque content should not be compressed or clipped, (2) that the view prefers to hug tightly to its content.

 

A user of a view may need to specify the priority of these constraints.  For example, by default, a push button

-strongly wants to hug its content in the vertical direction (buttons really ought to be their natural height)

-weakly hugs its content horizontally (extra side padding between the title and the edge of the bezel is acceptable)

-strongly resists compressing or clipping content in both directions.

 

However, you might have a case where you'd prefer to show all the available buttons with truncated text rather than losing some of the buttons. The truncation might only happen in portrait orientation but not in landscape, for example. In that case you'd want
to setContentCompressionResistancePriority:forAxis: to (say) UILayoutPriorityDefaultLow for the horizontal axis.

 

The default 'strong' and 'weak' priorities referred to above are UILayoutPriorityDefaultHigh and UILayoutPriorityDefaultLow.

 

Note that not all views have an intrinsicContentSize.  UIView's default implementation is to return (UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric).  The _intrinsic_ content size is concerned only with data that is in the view itself, not in other views.
Remember that you can also set constant width or height constraints on any view, and you don't need to override instrinsicContentSize if these dimensions won't be changing with changing view content.

*/

UIKIT_EXTERN
const CGFloat UIViewNoIntrinsicMetric
NS_AVAILABLE_IOS(6_0);
// -1

- (CGSize)intrinsicContentSize
NS_AVAILABLE_IOS(6_0);

- (void)invalidateIntrinsicContentSize
NS_AVAILABLE_IOS(6_0);
// call this when something changes that affects the intrinsicContentSize.  Otherwise UIKit won't notice that it changed.

 

- (UILayoutPriority)contentHuggingPriorityForAxis:(UILayoutConstraintAxis)axis
NS_AVAILABLE_IOS(6_0);

- (void)setContentHuggingPriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis
NS_AVAILABLE_IOS(6_0);

 

- (UILayoutPriority)contentCompressionResistancePriorityForAxis:(UILayoutConstraintAxis)axis
NS_AVAILABLE_IOS(6_0);

- (void)setContentCompressionResistancePriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis
NS_AVAILABLE_IOS(6_0);

@end

 

// Size To Fit

 

UIKIT_EXTERN
const CGSize UILayoutFittingCompressedSize
NS_AVAILABLE_IOS(6_0);

UIKIT_EXTERN
const CGSize UILayoutFittingExpandedSize
NS_AVAILABLE_IOS(6_0);

 

@interface UIView (UIConstraintBasedLayoutFittingSize)

/* The size fitting most closely to targetSize in which the receiver's subtree can be laid out while optimally satisfying the constraints. If you want the smallest possible size, pass UILayoutFittingCompressedSize; for the largest possible size, pass UILayoutFittingExpandedSize.

Also see the comment for UILayoutPriorityFittingSizeLevel.

*/

- (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize
NS_AVAILABLE_IOS(6_0);
// Equivalent to sending -systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority: with UILayoutPriorityFittingSizeLevel for both priorities.

- (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize withHorizontalFittingPriority:(UILayoutPriority)horizontalFittingPriority
verticalFittingPriority:(UILayoutPriority)verticalFittingPriority
NS_AVAILABLE_IOS(8_0);

@end

 

// Debugging

 

/* Everything in this section should be used in debugging only, never in shipping code.  These methods may not exist in the future - no promises.

*/

@interface UIView (UIConstraintBasedLayoutDebugging)

 

/* This returns a list of all the constraints that are affecting the current location of the receiver.  The constraints do not necessarily involve the receiver, they may affect the frame indirectly.

Pass UILayoutConstraintAxisHorizontal for the constraints affecting [self center].x and CGRectGetWidth([self bounds]), and UILayoutConstraintAxisVertical for the constraints affecting[self center].y and CGRectGetHeight([self bounds]).

*/

- (NSArray *)constraintsAffectingLayoutForAxis:(UILayoutConstraintAxis)axis
NS_AVAILABLE_IOS(6_0);

 

/* If there aren't enough constraints in the system to uniquely determine layout, we say the layout is ambiguous.  For example, if the only constraint in the system was x = y + 100, then there are lots of different possible values for x and y.  This situation
is not automatically detected by UIKit, due to performance considerations and details of the algorithm used for layout.

The symptom of ambiguity is that views sometimes jump from place to place, or possibly are just in the wrong place.

-hasAmbiguousLayout runs a check for whether there is another center and bounds the receiver could have that could also satisfy the constraints.

-exerciseAmbiguousLayout does more.  It randomly changes the view layout to a different valid layout.  Making the UI jump back and forth can be helpful for figuring out where you're missing a constraint.

*/

- (BOOL)hasAmbiguousLayout
NS_AVAILABLE_IOS(6_0);

- (void)exerciseAmbiguityInLayout
NS_AVAILABLE_IOS(6_0);

@end

 

@interface UIView (UIStateRestoration)

@property (nonatomic,
copy) NSString *restorationIdentifier
NS_AVAILABLE_IOS(6_0);

- (void) encodeRestorableStateWithCoder:(NSCoder *)coder
NS_AVAILABLE_IOS(6_0);

- (void) decodeRestorableStateWithCoder:(NSCoder *)coder
NS_AVAILABLE_IOS(6_0);

@end

 

@interface UIView (UISnapshotting)

/*

* When requesting a snapshot, 'afterUpdates' defines whether the snapshot is representative of what's currently on screen or if you wish to include any recent changes before taking the snapshot.

 

If called during layout from a committing transaction, snapshots occurring after the screen updates will include all changes made, regardless of when the snapshot is taken and the changes are made. For example:

 

- (void)layoutSubviews {

UIView *snapshot = [self snapshotViewAfterScreenUpdates:YES];

self.alpha = 0.0;

}

 

The snapshot will appear to be empty since the change in alpha will be captured by the snapshot. If you need to animate the view during layout, animate the snapshot instead.

 

* Creating snapshots from existing snapshots (as a method to duplicate, crop or create a resizable variant) is supported. In cases where many snapshots are needed, creating a snapshot from a common superview and making subsequent snapshots from it can be more
performant. Please keep in mind that if 'afterUpdates' is YES, the original snapshot is committed and any changes made to it, not the view originally snapshotted, will be included.

*/

- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates
NS_AVAILABLE_IOS(7_0);

- (UIView *)resizableSnapshotViewFromRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates
withCapInsets:(UIEdgeInsets)capInsets
NS_AVAILABLE_IOS(7_0);
// Resizable snapshots will default to stretching the center

// Use this method to render a snapshot of the view hierarchy into the current context. Returns NO if the snapshot is missing image data, YES if the snapshot is complete. Calling this method from layoutSubviews while the current transaction is committing will
capture what is currently displayed regardless if afterUpdates is YES.

- (BOOL)drawViewHierarchyInRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates
NS_AVAILABLE_IOS(7_0);

@end

作者:luobo140716 發表於2015/6/12 16:32:59 原文鏈接
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved