您的位置:首页 > 产品设计 > UI/UE

ios学习-UIView方法

2013-11-13 14:10 309 查看
UIView位置与尺寸: 1.initWithFrame:
2.frame属性和center属性
修改背景色: backgroundColor属性
设置透明色: alpha属性

UIView内容管理

内容的自动尺寸调整: contentMode属性
指定内容的伸缩区域: ContentStretch属性 (CGRect)
适应内容: sizeToFit方法
Affine变换: transform属性 (CGAffineTransform)

UIView嵌套

追加子元素: addSubView:
insertSubview:atIndex:
insertSubview:aboveSubview:
insertSubview:belowSubview:
删除子元素: removeFromSuperview:
交换子元素顺序: exchangeSubviewAtIndex:withSubviewAtIndex:
靠前显示: bringSubviewToFront:
靠后隐藏: sendSubviewToBack:
UIView的检索: viewWithTag:

UIView的外观

外观自动调整: 调用setNeedsLayout方法 自动调用 layoutSubViews
子元素自动尺寸调整: UIView的 autoresizeSubviews属性(YES/NO) autoresizingMask属性
( UIViewAutoresizingNone 无自动调整
UIViewAutoresizingFlexibleLeftMargin 调整左侧间距
UIViewAutoresizingFlexibleRightMargin 调整右侧间距
UIViewAutoresizingFlexibleTopMargin 调整顶部间距
UIViewAutoresizingFlexibleBottomMargin 调整底部间距
UIViewAutoresizingFlexibleWidth 调整宽度
UIViewAutoresizingFlexibleHeight 调整高度 )
坐标变换:
convertPoint:toView:
convertRect:toView:
convertPoint:fromView:
convertRect:fromView:

UIView的状态监视

UIView追加子元素后: - (void) didAddSubview: (UIView*) subview
UIView删除子元素前: - (void)willRemoveSubview: (UIView*) subview
UIView作为UIView子元素被追加/删除前: - (void)willMoveToSurperview:(UIView*)newSurperview
UIView作为UIView子元素被追加/删除后: - (void)didMobeToSurperview
UIView作为UIWindow子元素被追加/删除前: - (void)willMoveToWindow:(UIWindow*)newWindow
UIView作为UIWindow子元素被追加/删除后: -(void) didMoveToWindow
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: