iOS7 新UI 一

文章转自:http://blog.csdn.net/lizhongfu2013/article/details/9124893

IOS7在UI方面发生了很大改变,所以感觉有必要重新审视的学习一下(新特性+以前未注意到的特性)。

现在开始了:


1、UIView:


a)view.clearsContextBeforeDrawing =YES  <IOS6>

When the Clears Graphics Context (clearsContextBeforeDrawing) checkbox is selected, the drawingbuffer is automatically cleared to transparent black before the view is drawn. This behavior ensures thatthere are no visual artifacts left over when the view’s contents are redrawn. (UIView每次重会之前,清除掉上次的内容,由于系统默认就是YES,所以忽略这个特性了,这个特性不是IOS7才有的)


b)Appearance Proxies  <IOS6>

代码和效果图:

1>To customize the appearance of all instances of a class, useappearanceto get the appearance proxy forthe class (让某一类控件同时表现某种属性)

    [[UIButton appearance]setBackgroundColor:[UIColorredColor]];

    [[UIButton appearance]setTitle:@"ssss"forState:UIControlStateNormal];

2>

To customize the appearances for instances of a class when contained within an instance of a containerclass, or instances in a hierarchy, you useappearanceWhenContainedIn:to get the appearance proxyfor the class. (

  
 

让某一类控件在另一种控件中同时表现某种属性

  
 

)

    

[[UIButton  appearanceWhenContainedIn:[UIView  class],nil]  setTitleColor:[UIColor   greenColor]

                                                                   forState:UIControlStateNormal];



Appearance Proxies 特性在IOS7以前可用,但并不那么显眼,但IOS7之后,由于UI的外表的改变,看起来更明显了,如图:


注意:

You can use an appearance proxy to set particular appearance properties for all instances of a view in yourapplication. (所有继承自UIView的控件都有这个特征,只不过不同的控件会以不同的方式展现这个特性)

更多代码:

[[UISlider appearance] setMinimumTrackTintColor:[UIColor greenColor]];
[[UISlider appearanceWhenContainedIn:[UIView class], nil]
            setMinimumTrackTintColor:[UIColor greenColor]];


c)Using Template Images <IOS7>

模版图片:

UIImage *myImage = [UIImage imageNamed:@"myImageFile.png"];
myImage = [myImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];


UIImageRenderingModeAutomatic,          // Use the default rendering mode for the context where the image is used
UIImageRenderingModeAlwaysOriginal,     // Always draw the original image, without treating it as a template
UIImageRenderingModeAlwaysTemplate,     // Always draw the image as a template image, ignoring its color information
这个不理解有什么用,高人指点~~

d)

Using Auto Layout with Views 

看这几篇,应该可以入门:


2、
  
 

UIActionSheet

  
 
:<IOS7样式>



不要吃惊,屏幕下方的真的是UIActionSheet,实现方式没有改变,但就是这样式……

UIActionSheet *actionSheet = [[UIActionSheetalloc]initWithTitle:nil

                                                             delegate:nil

                                                    cancelButtonTitle:@"Cancel"

                                               destructiveButtonTitle:@"Delete"

                                                    otherButtonTitles:@"one"@"two",nil];

  [actionSheet showInView:self.view];


3、UIActivityIndicatorView
  
 

    [[UIActivityIndicatorViewappearance]setColor:[UIColorblueColor]];

    UIActivityIndicatorView *indicator = [[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

    indicator.frame = CGRectMake(180,100,100,100);

    [self.view addSubview:indicator];

    [indicator startAnimating];


   这样一看,转圈也好像顺眼多了。


4、UIAlertView:
  
 
<IOS7样式>
  
 

实现方式没有改变



注意:

1、做版本兼容时候,发现 UIAlertView 的 visible 属性貌似失效了。


5、 UICollectionView  
  
 
<IOS6>
  
 

高级控件,适合做相册效果: http://blog.sina.com.cn/s/blog_5a6efa330101doc9.html


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值