+ (UIColor *)blackColor; // 0.0 white
(UIColor *)darkGrayColor; // 0.333 white
(UIColor *)lightGrayColor; // 0.667 white
(UIColor *)whiteColor; // 1.0 white
(UIColor *)grayColor; // 0.5 white
(UIColor *)redColor; // 1.0, 0.0, 0.0 RGB
(UIColor *)greenColor; // 0.0, 1.0, 0.0 RGB
(UIColor *)blueColor; // 0.0, 0.0, 1.0 RGB
(UIColor *)cyanColor; // 0.0, 1.0, 1.0 RGB
(UIColor *)yellowColor; // 1.0, 1.0, 0.0 RGB
(UIColor *)magentaColor; // 1.0, 0.0, 1.0 RGB
(UIColor *)orangeColor; // 1.0, 0.5, 0.0 RGB
(UIColor *)purpleColor; // 0.5, 0.0, 0.5 RGB
(UIColor *)brownColor; // 0.6, 0.4, 0.2 RGB
(UIColor *)clearColor; // 透明色
根据RGB组合创建颜色
+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
/*需要执行的动画的代码*/
[UIView commitAnimations];
//动画执行两秒钟
[UIView animateWithDuration:2.0 animations:^{
self.shopsView.alpha = 0.0;//透明度变为0.0
}];
//1s后再执行动画,动画执行两秒钟
//options(动画的选项):kNilOptions
[UIView animateWithDuration:2.0 delay:1.0 options:kNilOptions animations:^{self.shopsView.alpha = 0.0;} completion:^(BOOL finished){NSLog(@"播放完毕");}];
自定义按钮: 调整内部的子控件frame
内边距
//设置按钮内容的内边距(影响到imageView和titleLabel)
@property (nonatomic) UIEdgeInsets contentEdgeInsets;
//设置titleLabel的内边距(影响到titleLabel)
@property(nonatomic) UIEdgeInsets titleEdgeInsets;
//设置imageView的内边距(影响到imageView)
@property(nonatomic) UIEdgeInsets imageEdgeInsets;
注意
拉伸
保护图片边缘
iOS5之前
//只会中间的拉伸1*1部分
//rightCapWidth = width - leftCapWidth - 1;
//bottomCapWidth = width - topCapWidth - 1;
(UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight;
iOS5之后
- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets; // create a resizable version of this image. the interior(内部) is tiled(平铺的) when drawn(拉伸).
(UIEdgeInsets)capInsets-->UIEdgeInsetsMake(top, left, bottom, right)
//resizingMode: 拉伸模式
- (UIStatusBarStyle)preferredStatusBarStyle
{
//白色
return UIStatusBarStyleLightContent;
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章