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 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学起(一)
本文转载至:http://blog.csdn.net/lizhongfu2013/article/details/9124893 IOS7在UI方面发生了很大改变,所以感觉有必要重新审视的学习一下(新 ...
- IOS7开发~新UI学起(三)
1.UITextView: A ) IOS7新增加的 UITextViewDelegate 方法: - (BOOL)textView:(UITextView *)textView shoul ...
- IOS7开发~新UI学起(二)
本文转载至 http://blog.csdn.net/lizhongfu2013/article/details/9133281 1.UINavigationBar: NSDictionary* at ...
- 四核驱动的三维导航—淘宝新UI(设计篇)
前面有一篇博客说到了淘宝UWP的"四核驱动的三维导航—淘宝新UI(需求分析篇)",花了两周的时间实现了这个框架,然后又陆陆续续用了三周的时间完善它. 多窗口导航,与传统的导航方式的 ...
- IOS7学习之路一(新UI之自定义UITableViewCell)
ios7 新升级之后界面有了很大的变化,xcode模拟器去掉了手机边框和home键,如果想回到主页面,可以按住shift+comment+r键.废话少说先展示一下新UI下UItableView设置为G ...
- UGUI的优点新UI系统四 开源
UGUI的优点新UI系统四 开源 新UI系统是开源的,所以开发者可以看到新UI系统实现的源码,并加以修改和使用. 开源授权协议——MIT/X11 Unity所搭载的新UI系统,是在开源授权协议MIT/ ...
- Mina、Netty、Twisted一起学(四):定制自己的协议
在前面的博文中,介绍一些消息分割的方案,以及MINA.Netty.Twisted针对这些方案提供的相关API.例如MINA的TextLineCodecFactory.PrefixedStringCod ...
- iOS开发~UI布局(三)深入理解autolayout
一.概要 通过对iOS8界面布局的学习和总结,发现autolayout才是主角,autolayout是iOS6引入的新特性,当时还粗浅的学习了下,可是没有真正应用到项目中.随着iOS设备尺寸逐渐碎片化 ...
- 开发者所需要知道的iOS7 SDK新特性
iOS 7 春风又绿加州岸,物是人非又一年.WWDC 2013 keynote落下帷幕,新的iOS开发旅程也由此开启.在iOS7界面重大变革的背后,开发者们需要知道的又有哪些呢.同去年一样,我会先简单 ...
随机推荐
- PHP-权限控制类(转)
<?php /** * 权限控制类 */ class include_purview { /** * 类的唯一实例 */ private static $instance; /** * 权限常量 ...
- js 温故而知新 用typeof 来判断一个未定义的变量
一直以为,如果你使用一个未定义的变量,肯定会报错.甚至根本不可能有这种场景. 但仔细想想还是有的,譬如你要判断全局是否存在$变量.或者要为全局暴漏一个全局变量之前,先判断是否有这个变量. typeof ...
- Object-C中的字符串对象1-不可变字符串
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { ...
- http_load使用详解
1.什么是http_loadhttp_load是一款基于Linux平台的web服务器性能测试工具,用于测试web服务器的吞吐量与负载,web页面的性能. 2.http_load的安装1)下载地址wge ...
- CentOS 6.2修改主机名
写在前面的话:因为服务器要统一主机名,但是在安装的时候忘记设置了,所以需要修改主机名 需要修改两处:一处是/etc/sysconfig/network,另一处是/etc/hosts,只修改任一处会 ...
- Python 元祖的操作
注意:元祖定义后不可修改,单个元祖后面必须加逗号,否则认为是字符串:tuple = ('apple',) 1.定义元祖 tuple = ('apple','banana','grape','orang ...
- json中把非json格式的字符串转换成json对象再转换成json字符串
JSON.toJson(str).toString()假如key和value都是整数的时候,先转换成jsonObject对象,再转换成json字符串
- 纯css3实现的竖形二级导航
之前为大家分享了好多导航菜单.今天给大家带来一款纯css3实现的竖形二级导航.这款导航菜单可以是无限级.一起看下效果图: 在线预览 源码下载 实现的代码. html代码: <div styl ...
- js去掉双引号
替换: d = d.replace("\"","").replace("\"",""); 全部替换: ...
- JavaScrip——简单练习(输出方式,简单表单验证)
<script> //输出方式 document.write(Date());//获取当前时间 document.write(1); document.write("<p& ...