iOS项目开发经验:【常用代码4】
来源:互联网 发布:图像虚化处理算法 编辑:程序博客网 时间:2024/04/29 16:28
<4-1>获取当前时间
NSString *nowDateString = [NSDateFormatter localizedStringFromDate:[NSDate date] dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle];
<4-2>在子viewController中隐藏tabbar
viewController.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:viewController animated:YES];
<4-3>查看设备支持的字体:
for (NSString *family in [UIFont familyNames]) { NSLog(@"%@", family); for (NSString *fontName in [UIFont fontNamesForFamilyName:family]) { NSLog(@"\t %@", fontName); }}
<4-4>开发调试和发布阶段日志控制,打开宏定义
#ifndef __OPTIMIZE__ #define NSLog(...) NSLog(__VA_ARGS__) #else #define NSLog(...)#endif
<4-5>去掉UITableView中Cell之间的分割线
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
<4-6>UITableView滚动到最下面
- (void)scrollToFoot:(BOOL)animated { NSInteger section = [self.tableView numberOfSections]; if (section<1) return; NSInteger row = [self.tableView numberOfRowsInSection:section-1]; if (row<1) return; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row-1 inSection:section-1]; [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:animated]; }
<4-7> UITextView支持超链接,电话
在iPhone 3.0后就支持UIDataDetectorTypes来检测数字和链接。UIDataDetectorTypePhoneNumberUIDataDetectorTypeLinkUIDataDetectorTypeNoneUIDataDetectorTypeAll通过设置dataDetectorTypes属性就可以实现功能- (void)viewDidLoad { self.textView.dataDetectorTypes = UIDataDetectorTypeAll; }
- iOS项目开发经验:【常用代码4】
- iOS项目开发经验:【常用代码1】
- iOS项目开发经验:【常用代码2】
- iOS项目开发经验:【常用代码3】
- iOS项目开发经验:【常用代码5】
- iOS项目开发经验:【常用代码6】
- iOS项目开发经验:【常用代码7】
- iOS开发常用代码,经验分享。
- ios项目常用代码
- IOS项目常用代码
- IOS项目常用代码
- IOS---------------------------开发常用代码
- ios 开发常用代码
- iOS开发常用代码
- iOS开发常用代码
- iOS开发常用代码
- iOS-常用开发代码
- IOS开发常用代码汇总4
- 一个无重复面值的找零算法的思路与实现(二)
- vb 6.0下面窗口Form的Picture属性不能更改问题
- 6、 java 输入一个数字组成的数组,输出该数组的最大值和最小值
- ios6下画面旋转的问题
- JavaScript对象浅谈
- iOS项目开发经验:【常用代码4】
- 输出所有的字符组合(可重复)
- 100盏灯泡的亮灭
- Google面试题:找几百亿数据的中值
- 括号匹配(小中大括号序列)
- 健康作息时间
- 7、 java 编写程序获取已知文件的扩展名. 注意: abc.txt的扩展名是txt, abc.java.txt的扩展名也是txt.
- tcp 报文格式
- 8、 java 先写一个程序,打印从1到100的值。之后修改程序,通过使用break关键词,使得程序在打印到98时退出。然后尝试使用return来达到相同的目的。