Objective-C 学习记录 - 8

1.UILabel常用属性:

@property (nonatomic, copy) NSString *text;
//显示的文字
@property (nonatomic, retain) UIFont *font;
//字体
@property (nonatomic, retain) UIColor *color;
//文字颜色
@property (nonatomic) NSTextAlignment *textAlignment;
//对齐方式(左对齐、右对齐、居中对齐、两端对齐等)
@property (nonatomic) NSInteger numberOfLines;
//文字行数(设置为0时是自动换行)
@property (nonatomic) NSLineBreakMode lineBreakMode;
//显示(换行及省略)模式

2.UIImageView的显示模式(UIViewContentMode)

    UIViewContentModeScaleToFill,          //Scale To Fill  拉伸填充,充满整个view

    UIViewContentModeScaleAspectFit,          //Aspect Fit  维持原比例,自适应填充不超过边框

    UIViewContentModeScaleAspectFill,          //Aspect Fill  维持原比例,完全填满view

    UIViewContentModeRedraw,          //Redraw  重新绘制(drawRect)

    UIViewContentModeCenter,          //Center  居中

    UIViewContentModeTop,          //Top/Bottom/Left/Right:顶部/底部/左边/右边对齐

    UIViewContentModeBottom,

    UIViewContentModeLeft,

    UIViewContentModeRight,

    UIViewContentModeTopLeft,          //TopLeft/TopRight/BottomLeft/BottomRight:四角对齐

    UIViewContentModeTopRight,

    UIViewContentModeBottomLeft,

    UIViewContentModeBottomRight,

3.将子控件填充满整个父控件最简单的办法:

view2.frame = view1.bounds;
[view1 addSubview:view2]; 

因为bounds = CGRectMake(0,0,width.height) 

4.设置毛玻璃效果的方法:使用UIToolbar对象(自带毛玻璃效果)
使用UIToolbar控件覆盖需要毛玻璃效果的区域

猜你喜欢

转载自blog.csdn.net/XtheEpic/article/details/81349426