[转]Iphone 开发小技巧
2011-04-21 17:05
169 查看
http://www.xffox.com/blog/iphone-%E5%BC%80%E5%8F%91%E5%B0%8F%E6%8A%80%E5%B7%A7
当你设置数值为0时将会隐藏图标数字。默认是0 2, 如何改变导航条的背景颜色? Answer: 如果时在ViewController中修改则使用类似如下代码: self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.03 green:0.215 blue: 0.298 alpha:1]; 3, 如何显示顶部状态栏中的网络忙指示器? Answer: 设置 networkActivityIndicatorVisible = YES即可, 不需要时将其赋值NO即可 4, 如何弹出网络链接对话框? Answer: 如果程序中用到网络,按照app store的规定需要弹出网络连接对话框提示用户。只需要在Info.plist文件中添加信的条目:UIRequiresPersistentWiFi 类型为Boolean,值为YES即可 5, 把UIView覆盖到状态栏上的方法 首先 继承 UIWindow, init的方法: 关键的语句 self.windowLevel=UIWindowLevelAlert;
5, 以密码方式显示UITextField文本?
6, 使用NSTask调用外部程序.
Iphone 开发小技巧
1, 如何在程序图标上显示数字? Answer: 在程序退出或者改变时修改[UIApplication sharedApplication].applicationIconBadgeNumber的值即可当你设置数值为0时将会隐藏图标数字。默认是0 2, 如何改变导航条的背景颜色? Answer: 如果时在ViewController中修改则使用类似如下代码: self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.03 green:0.215 blue: 0.298 alpha:1]; 3, 如何显示顶部状态栏中的网络忙指示器? Answer: 设置 networkActivityIndicatorVisible = YES即可, 不需要时将其赋值NO即可 4, 如何弹出网络链接对话框? Answer: 如果程序中用到网络,按照app store的规定需要弹出网络连接对话框提示用户。只需要在Info.plist文件中添加信的条目:UIRequiresPersistentWiFi 类型为Boolean,值为YES即可 5, 把UIView覆盖到状态栏上的方法 首先 继承 UIWindow, init的方法: 关键的语句 self.windowLevel=UIWindowLevelAlert;
- (id) init {
CGRect f=[[UIScreen mainScreen] bounds];
CGRect s=[[UIApplication sharedApplication] statusBarFrame];
self = [super initWithFrame:CGRectMake(0, 0, f.size.width, s.size.height)];
if (self != nil) {
self.windowLevel=UIWindowLevelAlert;
self.backgroundColor=[UIColor clearColor]; [self makeKeyAndVisible]; } return self;
}
5, 以密码方式显示UITextField文本?
Answer:textField.secureTextEntry = YES;
6, 使用NSTask调用外部程序.
- (void)runExternalProcess { NSTask *task = [[NSTask alloc] init]; NSPipe *pipe = [NSPipe pipe]; NSFileHandle *readHandle = [pipe fileHandleForReading]; NSData *inData = nil; [task setStandardOutput:pipe]; [task setLaunchPath:@"/usr/bin/curl"]; [task setArguments:[NSArray arrayWithObject:@"http://blog.codingmylife.com"]]; [task launch]; while((inData = [readHandle availableData]) && [inData length]) { NSString *temp = [[NSString alloc] initWithData:inData encoding:NSUTF8StringEncoding]; } [task release]; }
相关文章推荐
- iphone开发技巧整合
- iPhone开发之NSLog使用技巧
- iPhone开发技巧之工具篇(4)--- 使用afconvert转换WAV文件
- 开发适应iphone/ipad及多ios版本程序的技巧
- iPhone开发技巧之调试篇(2)— 保存日志
- iPhone开发技巧之网络篇(1)— 解析XML
- iphone开发技巧整合
- iPhone开发技巧之私有API(2)--- UITableView
- iphone开发小技巧
- 转:iphone/ipad网站开发技巧整理
- iPhone开发技巧之私有API — 设备相关信息
- iPhone开发中的技巧整理(二)
- 转:iPhone开发技巧之私有API(1) — 设备相关信息
- iPhone开发技巧之私有API — 设备相关信息
- iPhone开发技巧之数据篇(1)--- 使用正则表达式
- iPhone开发技巧之私有API(4)--- UIBarButtonItem
- iPhone开发中的技巧整理
- iPhone开发技巧
- iphone 开发技巧总结篇
- iPhone开发技巧之私有API--- UIBarButtonItem