iOS7 新UI 四

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


1、UITableView:



UITableViewDelegate 新增内容:

// Use the estimatedHeigh(估算高度)t methods to quickly calcuate guessed values which will allow for fast load times of the table.

// If these methods are implemented, the above -tableView:heightForXXX calls will be deferred until views are ready to be displayed, so more expensive logic can be placed there.

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath

{

   return50;

}  //  这个方法先返回一个估算的cell高度

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{    kPrintInfo

    return 40;

} 然后这个方法才返回真正的cell高度


这两个方法同理

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section;

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section;


新增属性:

@property(nonatomic)         CGFloat                    estimatedRowHeight ;// default is 0, which means there is no estimate

@property(nonatomic)         CGFloat                    estimatedSectionHeaderHeight ;// default is 0, which means there is no estimate

@property(nonatomic)         CGFloat                    estimatedSectionFooterHeight ;// default is 0, 

通过新增代理放大不难知道,上述三个新增属性不难理解了。


// the background color of the section index while not being touched(当section不被触摸时候的背景颜色)

@property(nonatomic,retain)UIColor *sectionIndexBackgroundColor;         


2、UIButton:

UIButton的这个属性是 IOS6引入的,以前没注意到:

- (void)setAttributedTitle:(NSAttributedString *)title forState:(UIControlState)stateNS_AVAILABLE_IOS(6_0);// default is nil. title is assumed to be single line

用法如下:

- (NSMutableAttributedString *) getString

{

    NSMutableAttributedString *attriString = [[NSMutableAttributedStringalloc]initWithString:@"this is test!"];


    //改变this的字体,value必须是一个CTFontRef

    [attriString addAttribute:(NSString *)kCTFontAttributeName

                        value:CFBridgingRelease(CTFontCreateWithName((CFStringRef)[UIFontboldSystemFontOfSize:14].fontName,14,NULL))

                        range:NSMakeRange(0,4)];

    //this加上下划线,value可以在指定的枚举中选择 

    [attriString addAttribute:(NSString *)kCTUnderlineStyleAttributeName 

                        value:(id)[NSNumbernumberWithInt:kCTUnderlineStyleDouble

                        range:NSMakeRange(0,4)]; 

    return attriString;

}


- (void)viewDidLoad

{

    [superviewDidLoad];


    [btsetAttributedTitle:[selfgetString]forState:UIControlStateNormal];

}


3、UIDatePicker:


不想说什么了~


4、UISteper:

- (void)viewDidLoad

{

    [super viewDidLoad];

    

    UIStepper *myStepper = [[UIStepper allocinitWithFrame:CGRectMake(01032050)];

    myStepper.backgroundColor = [UIColor redColor];

    [myStepper addTarget:self

                       action:@selector(myAction:)

             forControlEvents:UIControlEventValueChanged];

    

    [self.view addSubview:myStepper];

}


- (void) myAction:(UIStepper *) sender

    CFShow((__bridge CFTypeRef)(@(sender.value)));

}


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值