最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

iOS UIView常見屬性方法小結(jié)

 更新時(shí)間:2016年12月15日 10:50:26   作者:敲代碼的樹懶  
本文通過實(shí)例代碼給大家詳細(xì)介紹了iOS UIView常見屬性方法,非常不錯(cuò),需要的朋友參考下吧

下面通過實(shí)例代碼給大家詳細(xì)介紹了iOS UIView常見屬性方法,具體代碼如下所示:

UIView : UIResponder
 /**
通過一個(gè)frame來初始化一個(gè)UI控件
 */
 - (id)initWithFrame:(CGRect)frame;
 // YES:能夠跟用戶進(jìn)行交互
@property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is YES
// 控件的一個(gè)標(biāo)記(父控件可以通過tag找到對應(yīng)的子控件)
@property(nonatomic)                 NSInteger tag;        // default is 0
// 圖層(可以用來設(shè)置圓角效果\陰影效果)
@property(nonatomic,readonly,retain)         CALayer *layer;
@interface UIView(UIViewGeometry)
// 位置和尺寸(以父控件的左上角為坐標(biāo)原點(diǎn)(0, 0))
@property(nonatomic) CGRect      frame;
// 位置和尺寸(以自己的左上角為坐標(biāo)原點(diǎn)(0, 0))
@property(nonatomic) CGRect      bounds;
// 中點(diǎn)(以父控件的左上角為坐標(biāo)原點(diǎn)(0, 0))
@property(nonatomic) CGPoint      center;   
// 形變屬性(平移\縮放\旋轉(zhuǎn))
@property(nonatomic) CGAffineTransform transform;  // default is CGAffineTransformIdentity
// YES:支持多點(diǎn)觸摸
@property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled;  // default is NO
@end
@interface UIView(UIViewHierarchy)
 // 父控件
@property(nonatomic,readonly) UIView    *superview;
// 子控件(新添加的控件默認(rèn)都在subviews數(shù)組的后面, 新添加的控件默認(rèn)都顯示在最上面\最頂部)
@property(nonatomic,readonly,copy) NSArray *subviews;
// 獲得當(dāng)前控件所在的window
@property(nonatomic,readonly) UIWindow   *window;
// 從父控件中移除一個(gè)控件
- (void)removeFromSuperview;
// 添加一個(gè)子控件(可以將子控件插入到subviews數(shù)組中index這個(gè)位置)
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
// 交換subviews數(shù)組中所存放子控件的位置
- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;
// 添加一個(gè)子控件(新添加的控件默認(rèn)都在subviews數(shù)組的后面, 新添加的控件默認(rèn)都顯示在最上面\最頂部)
- (void)addSubview:(UIView *)view;
// 添加一個(gè)子控件view(被擋在siblingSubview的下面)
- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
// 添加一個(gè)子控件view(蓋在siblingSubview的上面)
- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;
// 將某個(gè)子控件拉到最上面(最頂部)來顯示
- (void)bringSubviewToFront:(UIView *)view;
// 將某個(gè)子控件拉到最下面(最底部)來顯示
- (void)sendSubviewToBack:(UIView *)view;
/**系統(tǒng)自動(dòng)調(diào)用(留給子類去實(shí)現(xiàn))**/
- (void)didAddSubview:(UIView *)subview;
- (void)willRemoveSubview:(UIView *)subview;
- (void)willMoveToSuperview:(UIView *)newSuperview;
- (void)didMoveToSuperview;
- (void)willMoveToWindow:(UIWindow *)newWindow;
- (void)didMoveToWindow;
/**系統(tǒng)自動(dòng)調(diào)用**/
 // 是不是view的子控件或者子控件的子控件(是否為view的后代)
- (BOOL)isDescendantOfView:(UIView *)view; // returns YES for self.
 // 通過tag獲得對應(yīng)的子控件(也可以或者子控件的子控件)
- (UIView *)viewWithTag:(NSInteger)tag;   // recursive search. includes self
/**系統(tǒng)自動(dòng)調(diào)用(留給子類去實(shí)現(xiàn))**/
// 控件的frame發(fā)生改變的時(shí)候就會(huì)調(diào)用,一般在這里重寫布局子控件的位置和尺寸
// 重寫了這個(gè)寫方法后,一定調(diào)用[super layoutSubviews];
- (void)layoutSubviews;
@end
@interface UIView(UIViewRendering)
// YES : 超出控件邊框范圍的內(nèi)容都剪掉
@property(nonatomic)         BOOL       clipsToBounds;
// 背景色
@property(nonatomic,copy)      UIColor     *backgroundColor; // default is nil
// 透明度(0.0~1.0)
@property(nonatomic)         CGFloat      alpha;           // default is 1.0
// YES:不透明 NO:透明
@property(nonatomic,getter=isOpaque) BOOL       opaque;           // default is YES
 // YES : 隱藏 NO : 顯示
@property(nonatomic,getter=isHidden) BOOL       hidden;
 // 內(nèi)容模式
 @property(nonatomic)         UIViewContentMode contentMode;        // default is UIViewContentModeScaleToFill
 @end
 //動(dòng)畫
@interface UIView(UIViewAnimationWithBlocks)
+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations;
+ (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;
 @end

以上所述是小編給大家介紹的iOS UIView常見屬性方法小結(jié),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論

疏附县| 平泉县| 广平县| 密山市| 若尔盖县| 凉城县| 石城县| 东方市| 湘乡市| 凌源市| 罗甸县| 治县。| 嘉善县| 麦盖提县| 克拉玛依市| 东乌珠穆沁旗| 图们市| 芷江| 义马市| 武功县| 顺昌县| 密山市| 建湖县| 蒙山县| 大理市| 鹿邑县| 贡嘎县| 托克逊县| 潮安县| 谷城县| 泰安市| 赤水市| 马山县| 开原市| 华阴市| 遂宁市| 南川市| 利津县| 湖南省| 武威市| 屏山县|