标签:
6.1 UIScreen
// 屏幕的宽度
CGFloat screenW = [UIScreen mainScreen].bounds.size.width;
+ (UIFont *)systemFontOfSize:(CGFloat)fontSize; 系统默认字体
+ (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize; 粗体
+ (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize; 斜体
[UIColor clearColor];
center:可用作平移
bounds:可用作缩放
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelay:0.3f];
self.imgButton.center = p;
[UIView commitAnimations];
//block嵌套动画,先1秒钟时间显示label,finish后执行嵌套动画
//内嵌动画中,延迟2秒执行,首先1秒钟时间匀速隐藏label,finish后移除label
label.alpha = 0.0;
[UIView animateWithDuration:1.0f animations:^{
label.alpha = 0.5;
} completion:^(BOOL finished) {
[UIView animateWithDuration:1.0f delay:2.0f options:UIViewAnimationOptionCurveEaseInOutanimations:^{
label.alpha = 0.0f;
} completion:^(BOOL finished) {
[label removeFromSuperview];
}];
}];
6.4.6 动态创建
[self.view addSubview:appView];
6.4.7 圆角处理
.layer.cornerRadius = 5;
.layer.masksToBounds = YES;
[self.view bringSubviewToFront:self.imageIcon];
//当前控件布局时触发,子控件初始化frame需要用到父控件的frame时,需要写在此事件中
// 在每个headerView被添加到某个父控件中后触发.
- (void)didMoveToSuperview。
//内容保持相同的尺寸
btnGroupName.imageView.clipsToBounds = NO;
当view背景颜色设置为clearColor时,被view覆盖的按钮虽然可以显示,但无法点击。当如果将设置view的透明度为0,则按钮既能显示,也可以点击。
//设置按钮的文字
- (void)setTitle:(NSString *)title forState:(UIControlState)state;
//设置按钮的文字颜色
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;
//设置按钮内部的小图片
- (void)setImage:(UIImage *)image forState:(UIControlState)state;
//设置按钮的背景图片
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;
//设置按钮的文字字体(需要拿到按钮内部的label来设置)
btn.titleLabel.font = [UIFont systemFontOfSize:13];
//设置按钮边缘间距
UIEdgeInsets insets = UIEdgeInsetsMake(0, 50, 0, 0);
self.button.contentEdgeInsets = insets;//对image和titleLabel同时有效
self.button.titleEdgeInsets = insets;//仅对titleLabel有效
self.button.imageEdgeInsets = insets;//仅对image有效
//获得按钮的文字
- (NSString *)titleForState:(UIControlState)state;
//获得按钮的文字颜色
- (UIColor *)titleColorForState:(UIControlState)state;
//获得按钮内部的小图片
- (UIImage *)imageForState:(UIControlState)state;
//获得按钮的背景图片
addTarget绑定事件
UIScreen,UIFont,UIColor,UIView,UIButton等总结
标签:
原文地址:http://www.cnblogs.com/linxiu-0925/p/5058108.html