IOS项目中的细节处理,如更改状态栏等等
一,状态栏更改为白色
1 在info.plist中添加一个字段:view controller -base status bar 为NO

2 在需要改变状态栏颜色的ViewController中在ViewDidLoad方法中增加:
[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
如果需要在全部View中都变色,可以写在父类的相关方法中,或者写到AppDelegate中。
二 :去除navigationbar 底部黑线 ——亲测可用
if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){
NSArray *list=self.navigationController.navigationBar.subviews;
for (id obj in list) {
if ([obj isKindOfClass:[UIImageView class]]) {
UIImageView *imageView=(UIImageView *)obj;
NSArray *list2=imageView.subviews;
for (id obj2 in list2) {
if ([obj2 isKindOfClass:[UIImageView class]]) {
UIImageView *imageView2=(UIImageView *)obj2;
imageView2.hidden=YES;
}
}
}
}
}
1、采用imageNamed方法的图片加载情况
图片资源反复使用到,如按钮背景图片的蓝色背景,这些图片要经常用到,而且占用内存少
2、不应该采用的情况:
(1)图片一般只使用一次,如一些用户的照片资源
(2)图片资源较大,加载到内存后,比较耗费内存资源
四 Unix时间转换
NSNumber *dateStr = [data valueForKey:@"lastLogTime"];
double unixTimeStamp = [dateStr doubleValue];
NSTimeInterval _interval=unixTimeStamp;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
NSDateFormatter *_formatter=[[NSDateFormatter alloc]init];
[_formatter setLocale:[NSLocale currentLocale]];
[_formatter setDateFormat:@"dd.MM.yyyy"];
NSString *_date=[_formatter stringFromDate:date];
或者:
[obj printAllPropertys];
nameLabel.text = [obj valueForKey:@"empName"];
orgLabel.text = [obj valueForKey:@"orgName"];
positionLabel.text = [obj valueForKey:@"position"];
cellPhoneLabel.text = [obj valueForKey:@"cellphone"]; NSString *dateNumber = [obj valueForKey:@"lastLogTime"];
NSLog(@"dateNumber%@",dateNumber); NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy/mm/dd hh:mm:ss"];
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[dateFormatter setTimeZone:timeZone];
//[dateFormatter setLocale:[NSLocale currentLocale]]; double unixTimeStamp = [dateNumber doubleValue];
NSTimeInterval _interval=unixTimeStamp;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
timeStr=[dateFormatter stringFromDate:date];
NSLog(@"loginTime:%@,_interval:%@",timeStr,dateNumber);
五,ios获取app版本号和项目名称
NSString *executableFile = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleExecutableKey]; //获取项目名称
NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey]; //获取项目版本号
浅谈IOS版本号:http://segmentfault.com/a/1190000002423661
NSString *deviceID = (NSString*) [[UIDevice currentDevice] identifierForVendor];//设备id
// NSString *deviceID = [UIApplication sharedApplication] uuid];
NSString *systemVersion = [[UIDevice currentDevice] systemVersion];//系统版本
NSString *systemModel = [[UIDevice currentDevice] model];//是iphone 还是 ipad
NSDictionary *dic = [[NSBundle mainBundle] infoDictionary];//获取info-plist
NSString *appName = [dic objectForKey:@"CFBundleIdentifier"];//获取Bundle identifier
NSString *appVersion = [dic valueForKey:@"CFBundleVersion"];//获取Bundle Version
NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:
deviceID, @"deviceID",
systemVersion, @"systemVersion",
systemModel, @"systemModel",
appName, @"appName",
appVersion, @"appVersion",nil]; NSLog(@"dic:%@",userInfo);
六,修改SearchBar的取消按钮的字体
///#begin
//
//功能描述:修改SearchBar的Cancel Button 的Title
// 注意点:
// 使用iOS8 SDK ,本次 UISearchBar适用于iOS7(+)版本,如果想要适配iOS6,则需要对应适配iOS6.
// 例如:
// iOS7+ : for(id cc in [searchBar.subviews[0] subviews]){}
// iOS7- : for(id cc in [searchBar subviews]){}
//
///#end
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
{
for(id cc in [searchBar.subviews[0] subviews])
{
if([cc isKindOfClass:[UIButton class]])
{
UIButton *btn = (UIButton *)cc;
[btn setTitle:[AppLanguageProcess getLanguageWithKey:@"TEXT_CANCEL"] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
}
}
}
待续
IOS项目中的细节处理,如更改状态栏等等的更多相关文章
- ios项目中引用其他项目复习
ios项目中引用其他开源项目,今天再次复习了,记个备注. 1. 将开源项目的.xcodeproj拖入项目frameworks 2. Build Phases下 Links Binary With Li ...
- iOS-C文件添加到iOS项目中,运行报错
iOS-C文件添加到iOS项目中,运行报错 问题: 往项目中添加一个空的c文件, 编译运行; 出现2,30个编译错误. 原因: 由于在项目中添加了Pch文件,在文件中所有代码还没有开始运行之前, pc ...
- iOS项目中常见的文件
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi ...
- XamarinSQLite教程Xamarin.iOS项目中打开数据库文件
XamarinSQLite教程Xamarin.iOS项目中打开数据库文件 以下是打开MyDocuments.db数据库的具体操作步骤: (1)将Mac电脑上的MyDocuments.db数据库移动到W ...
- XamarinSQLite教程在Xamarin.iOS项目中定位数据库文件
XamarinSQLite教程在Xamarin.iOS项目中定位数据库文件 开发者可以在指定的路径中找到复制的数据库文件,具体的操作步骤如下: (1)单击Mac电脑中Finder菜单中的“前往”|“前 ...
- 在Xamarin.iOS项目中使用预设数据库
在Xamarin.iOS项目中使用预设数据库 当开发者准备好一个预设数据库文件后,就可以将这个数据库文件添加到创建的项目中了.本节将分别在Xamarin.iOS和Xamarin.Android项目中使 ...
- 给iOS项目中添加图片,并通过UIImageView引用和显示该UIImage图片
[问题] 关于iOS/iPhone中的文件选择对话框,用于用户去选择图片等文件 过程中,问题转换为,需要给当前iOS项目中,添加一个图片. 类似于Windows开发中的资源文件,其中图片文件属于资源的 ...
- ios项目中安装和使用CocoaPods
CocoaPods是什么? http://code4app.com/article/cocoapods-install-usage http://blog.csdn.net/jjmm2009/arti ...
- iOS项目中安装和使用 Cocoapods
1.首先我们要打开我们的终端: 2.在终端输入 这条命令 gem sources -l 2.1如果是和我是一样的显示,则镜像已添加,无需更改,如果不一样,则需要进行更改 这里输出的如果是 https ...
随机推荐
- Mayor's posters---poj2528线段树、离散化
题目链接:http://poj.org/problem?id=2528 题意:有n张海报要贴,每张需要用的区间为L到R,后面的可以贴在之前的上面,就是吧之前的挡住,求最后我们能看到几张海报: 我们可以 ...
- 启动yarn
$cd /app/hadoop/hadoop-2.2.0/sbin $./start-yarn.sh
- sql server中的工作线程
/*在SQL SERVER 2005 及以后版本中, 使用'MAXworker thread' 来配置可用的线程数,默认设置为0 ,即自动控制线程数 计算最大工作线程数: 对于32 位系统:逻辑CPU ...
- MySQL完全卸载方法
1.在控制面板里把Mysql正常卸载 2.C:\Documents and Settings\All Users\Application Data\MySQL 这里还有MySQL的文件,必须要删除 注 ...
- 开源的挖矿软件,sha256
http://cryptomining-blog.com/tag/sha-256d-miner/ https://github.com/cbuchner1/CudaMiner/blob/master/ ...
- word 加载adobe acrobat ,保存word中的清晰图片
1:先安装 adobe 并激活 https://blog.csdn.net/xintingandzhouyang/article/details/82558235 2:打开word,点击 文件&g ...
- 用lua扩展你的Nginx(整理)
首先得声明.这不是我的原创,是在网上搜索到的一篇文章,原著是谁也搞不清楚了.按风格应该是属于章亦春的文章. 整理花了不少时间,所以就暂写成原创吧. 一. 概述 Nginx是一个高性能.支持高并发的,轻 ...
- 安插,复制,替换和删除ul中的li
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- js时钟
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Linux系统——MySQL基础(三)
### MySQL主从复制实践#### 主从复制实践准备(1)主从复制数据库实战环境准备MySQL主从复制实践对环境的要求比较简单,可以是单机单数据库多实例的环境,也可以是两台服务器,每个机器一个独立 ...