IOS 之 开发的一些小技巧

在平时的IOS开发中慢慢积累的一些小技巧.很有用处的哦.

1.获取系统的版本号 

NSFoundationVersionNumber 定义的浮点常量,[[[UIDevice currentDevicesystemVersionfloatValue返回系统版本号.

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];











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值