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界面重大变革的背后,开发者们需要知道的又有哪些呢.同去年一样,我会先简单 ...
随机推荐
- js表单验证控制代码大全
http://www.cnblogs.com/SAL2928/archive/2008/10/24/1319020.html目录: 1:js 字符串长度限制.判断字符长度.js限制输入.限制不能输入. ...
- 【转】Appium_API(翻译+用法说明)
转自:https://testerhome.com/topics/3711 1.contextscontexts(self): Returns the contexts within the curr ...
- linux下挂载win7的共享文件夹
由于跨平台开发的需要,需要在Linux和windows之间共享文件夹,所以找了一下方法,我试验了两种都可以使用. 首先声明一下我使用的是VMware10.CentOS6.2 一.手动操作 1.按照下图 ...
- std::string与output-operator"<<"的兼容问题
经查阅资料得知,“在某些编译器下std::string,需要使用c_str()才能作为output-operator "<<" 的参数” std::string tit ...
- qt 多点触摸
http://www.ptrackapp.com/apclassys-notes/embedded-linux-multitouch/ Embedded Linux Multitouch with Q ...
- Linux下tomcat启动
在Linux系统下,重启Tomcat使用命令操作的! 首先,进入Tomcat下的bin目录 cd /usr/local/tomcat/bin 使用Tomcat关闭命令 ./shutdown.sh 查看 ...
- 在Asp.net中为图像加入水印信息
using System.Drawing; using System.IO; using System.Drawing.Imaging; private void AddTextToImg(strin ...
- MyBatis-Spring 使用总结
说明:Java-based Config. 不是通过 mybatis 的 SqlSessionFactoryBuilder 来创建 SqlSessionFactory ,而是通过 mybatis-sp ...
- 嵌入式驱动开发之采集方式bypass mode---bypass mode
http://baike.baidu.com/link?url=HifFTlNRROR24lW_gSdTiG-eXooi08O0Eeq1mU6Yy0I1LOMW4kdumv25BOQbohV_428M ...
- 【BZOJ】2005: [Noi2010]能量采集(欧拉函数+分块)
http://www.lydsy.com/JudgeOnline/problem.php?id=2005 首先和某题一样应该一样可以看出每个点所在的线上有gcd(x,y)-1个点挡着了自己... 那么 ...