温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

IOS7开发~新UI学起

发布时间:2020-07-19 21:44:10 来源:网络 阅读:268 作者:wsajing111 栏目:移动开发

1、UITableView:

IOS7开发~新UI学起




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

return40;

} 然后这个方法才返回真正的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:

IOS7开发~新UI学起

不想说什么了~


4、UISteper:


- (void)viewDidLoad

{

[superviewDidLoad];


UIStepper *myStepper = [[UIStepperalloc] initWithFrame:CGRectMake(0, 10, 320, 50)];

myStepper.backgroundColor = [UIColorredColor];

[myStepper addTarget:self

action:@selector(myAction:)

forControlEvents:UIControlEventValueChanged];


[self.viewaddSubview:myStepper];

}


- (void) myAction:(UIStepper *) sender

{

CFShow((__bridgeCFTypeRef)(@(sender.value)));

}


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI