在平时的IOS开发中慢慢积累的一些小技巧.很有用处的哦.
1.获取系统的版本号
NSFoundationVersionNumber 定义的浮点常量,[[[UIDevice currentDevice] systemVersion] floatValue] 返回系统版本号.
2.获取一个区域是否包含一个点
CGRectContainsPoint(CGRect rect, CGPoint point)
3.让图标右上角显示数字
[UIApplication sharedApplication].applicationIconBadgeNumber = 数字
4.IOS7下导航栏挡住界面的话执行以下代码
self.edgesForExtendedLayout = UIRectEdgeNone;
5.[[UIApplication sharedApplication] openURL:]加载其它应用
调用谷歌地图:
NSString* searchQuery = @"1 Infinite Loop, Cupertino, CA 95014";
searchQuery = [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", searchQuery];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
调用邮件客户端(Apple Mail)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@eyecm.com"]];
拨号(Phone Number)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];
调用短信(SMS)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:10086"]];
调用浏览器(Safari Browser)
NSURL *url = [NSURL URLWithString:@"http://eyecm.com"];
[[UIApplication sharedApplication] openURL:url];
调用应用商店(AppStore)
NSURL *appStoreUrl = [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8"];
[[UIApplication sharedApplication] openURL:appStoreUrl];