iOS7 新UI 四
来源:互联网 发布:紫微斗数算命软件 编辑:程序博客网 时间:2024/05/25 21:35
文章转自: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 alloc] initWithFrame:CGRectMake(0, 10, 320, 50)];
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)));
}
- iOS7 新UI 四
- IOS7开发~新UI学起(四)
- IOS7开发~新UI学起(四)
- IOS7 UI新变化
- iOS7 新UI 一
- iOS7 新UI 二
- iOS7 新UI 三
- IOS7(新UI之自定义UITableViewCell)
- UINavigationController详解(四)iOS7新特性
- UINavigationController详解(四)iOS7新特性
- iOS7新特征汇总[01]:UI和多任务增强
- IOS7开发~新UI学起(一)
- IOS7开发~新UI学起(二)
- IOS7开发~新UI学起(三)
- IOS7开发~新UI学起(一)
- IOS7开发~新UI学起(二)
- IOS7开发~新UI学起(三)
- 四、新的UI and Alpha00
- 第八周项目三(1)if else语句解决多分段函数
- 项目五:定期存款利息计算器
- hadoop 安装,hadoop 源码打包
- DLNA介绍(包括UPnP,2011/6/20 更新)
- POJ 1016 Numbers That Count
- iOS7 新UI 四
- 用到的一些正则表达式
- 可信云上线公告
- Android 小项目之--使用【AudioManager】类控制音量
- 本月有几天
- 第八周项目4个人所得税计算器
- 代码块
- fedora14下如何安装bochs2.6.2
- CVE-2014-4114 和 CVE-2014-3566