標籤:
Initializing a View Object //初始化view
- (id)initWithFrame:(CGRect)aRect //通過一個矩形對象初始化
Configuring a View’s Visual Appearance //配置視覺展示
@property(nonatomic, copy) UIColor *backgroundColor //設定背景色
@property(nonatomic, getter=isHidden) BOOL hidden //隱藏view,預設為NO
@property(nonatomic) CGFloat alpha //設定透明度,0.0至1.0區間
@property(nonatomic, getter=isOpaque) BOOL opaque //告訴系統渲染器view是否不透明,設定YES可以加快渲染,預設為YES,如果設定了alpha值,應該設定為NO
@property(nonatomic) BOOL clipsToBounds //是否裁剪超出邊界的視圖,與css中overflow類似,預設為NO
@property(nonatomic) BOOL clearsContextBeforeDrawing //是否清除緩衝區中不可見內容,預設為YES,如果在一個滾動操作頻繁的視圖中,應該設為NO,以避免重新渲染,提升效能
+ (Class)layerClass //可以返回主layer所使用的類,UIView的子類可以通過重載這個方法,來讓UIView使用不同的CALayer來顯示
@property(nonatomic, readonly, retain) CALayer *layer //返回Core Animation層所使用的渲染方式
Configuring the Event-Related Behavior //配置事件關係
@property(nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled //設定view是否響應使用者事件,如touch、keyboard,預設為YES
@property(nonatomic, getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled //設定view是否響應多點觸摸,預設為NO
@property(nonatomic, getter=isExclusiveTouch) BOOL exclusiveTouch //設定touch是否排它,預設為NO
Configuring the Bounds and Frame Rectangles //配置邊界和矩形架構
@property(nonatomic) CGRect frame //設定view架構
@property(nonatomic) CGRect bounds //設定view邊界
@property(nonatomic) CGPoint center //設定中心點
@property(nonatomic) CGAffineTransform transform //設定transform,與css類似,CGAffineTransform是個矩陣結構體
Managing the View Hierarchy //管理檢視層級
@property(nonatomic, readonly) UIView *superview //返回父view,唯讀
@property(nonatomic, readonly, copy) NSArray *subviews //返回子view集合,唯讀
@property(nonatomic, readonly) UIWindow *window //返回window對象,唯讀
- (void)addSubview:(UIView *)view //添加一個子view到view中
- (void)bringSubviewToFront:(UIView *)view //把一個子view位置移動到列表最前
- (void)sendSubviewToBack:(UIView *)view //把一個子view位置向後移動一格
- (void)removeFromSuperview //把調用該方法的view從其父view中移除
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index //插入一個子view到指定索引,從0開始
- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview //插入一個子view到指定view之前
- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview //插入一個子view到指定view之後
- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2 //交換兩個view的索引
- (BOOL)isDescendantOfView:(UIView *)view //判斷是不是指定元素的子節點或是其本身
Configuring the Resizing Behavior //配置尺寸改變行為
@property(nonatomic) UIViewAutoresizing autoresizingMask //當父元素視窗尺寸改變時,子節點如何去自適應變化
@property(nonatomic) BOOL autoresizesSubviews //子view是否自適應變化,預設為YES
@property(nonatomic) UIViewContentMode contentMode //view自適應變化的方式
- (CGSize)sizeThatFits:(CGSize)size //傳遞view的尺寸,返回建議的子view尺寸
- (void)sizeToFit //調整view的尺寸去適應其內容
Laying out Subviews //布局子節點
- (void)layoutSubviews //布局子view
- (void)setNeedsLayout //在下次更新中重新整理布局
- (void)layoutIfNeeded //立即重新整理布局
Opting in to Constraint-Based Layout //選擇約束布局的方式
+ (BOOL)requiresConstraintBasedLayout //返回view是否是約束配置模式,ios6
- (BOOL)translatesAutoresizingMaskIntoConstraints //返回一個BOOL,判斷自動布局是否可為轉換約束布局,ios6
- (void)setTranslatesAutoresizingMaskIntoConstraints:(BOOL)flag //設定在約束布局系統中是否把自動布局轉換為約束布局,ios6
Managing Constraints //約束管理
- (NSArray *)constraints //返回view的約束控制代碼,ios6
- (void)addConstraint:(NSLayoutConstraint *)constraint //添加約束控制代碼,ios6
- (void)addConstraints:(NSArray *)constraints //添加約束控制代碼數組,ios6
- (void)removeConstraint:(NSLayoutConstraint *)constraint //刪除約束控制代碼,ios6
- (void)removeConstraints:(NSArray *)constraints //刪除約束控制代碼數組,ios6
Measuring in Constraint-Based Layout //測量約束布局
- (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize //返回最合適的尺寸,ios6
- (CGSize)intrinsicContentSize //返回view的自然尺寸,ios6
- (void)invalidateIntrinsicContentSize //使內容尺寸無效化,ios6
- (UILayoutPriority)contentCompressionResistancePriorityForAxis:(UILayoutConstraintAxis)axis //待補充,ios6
- (void)setContentCompressionResistancePriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis //待補充,ios6
- (UILayoutPriority)contentHuggingPriorityForAxis:(UILayoutConstraintAxis)axis //待補充,ios6
- (void)setContentHuggingPriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis //待補充,ios6
Aligning Views with Constraint-Based Layout //校準約束布局
- (CGRect)alignmentRectForFrame:(CGRect)frame //待補充,ios6
- (CGRect)frameForAlignmentRect:(CGRect)alignmentRect //待補充,ios6
- (UIEdgeInsets)alignmentRectInsets //待補充,ios6
- (UIView *)viewForBaselineLayout //待補充,ios6
Triggering Constraint-Based Layout //觸發約束布局
- (BOOL)needsUpdateConstraints //返回約束布局是否需要更新,YES為是,ios6
- (void)setNeedsUpdateConstraints //更新約束布局,ios6
- (void)updateConstraints //更新約束布局,ios6
- (void)updateConstraintsIfNeeded //更新約束布局及其子布局,ios6
Debugging Constraint-Based Layout //調試約束布局
- (NSArray *)constraintsAffectingLayoutForAxis:(UILayoutConstraintAxis)axis //待補充,ios6
- (BOOL)hasAmbiguousLayout //待補充,ios6
- (void)exerciseAmbiguityInLayout //待補充,ios6
Drawing and Updating the View //繪製和更新視圖
- (void)drawRect:(CGRect)rect //在view中繪製一個矩形
- (void)setNeedsDisplay //使view重繪
- (void)setNeedsDisplayInRect:(CGRect)invalidRect //指定矩形重繪
@property(nonatomic) CGFloat contentScaleFactor //待補充
Formatting Printed View Content //格式化內容
- (UIViewPrintFormatter *)viewPrintFormatter //返回view的列印對象
- (void)drawRect:(CGRect)area forViewPrintFormatter:(UIViewPrintFormatter *)formatter //使用某個地區來列印
Managing Gesture Recognizers //管理手勢
- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer //添加手勢辨識器
- (void)removeGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer //刪除手勢辨識器
@property(nonatomic, copy) NSArray *gestureRecognizers //擷取手勢集合
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer //通過傳回值決定是否識別此手勢
Animating Views with Blocks //使多個view執行動畫
+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion //使一個或多個view執行動畫
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion //使一個或多個view執行動畫
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations //使一個或多個view執行動畫
+ (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion //在一個view上建立過渡動畫
+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion //
Animating Views //view動畫
+ (void)beginAnimations:(NSString *)animationID context:(void *)context //標誌動畫代碼開始
ios開發 view視圖