1.设置icon上的数字图标
//设置主界面icon上的数字图标,在2.0中引进, 缺省为0 [UIApplicationsharedApplication].applicationIconBadgeNumber = 4;1234
2.设置摇动手势的时候,是否支持redo undo操作
//摇动手势,是否支持redo undo操作。12
//3.0以后引进,缺省YES
[UIApplicationsharedApplication].applicationSupportsShakeToEdit =YES;12
3.判断程序运行状态
//判断程序运行状态,在2.0以后引入 /* UIApplicationStateActive UIApplicationStateInactive UIApplicationStateBackground */123456789101112
if([UIApplicationsharedApplication].applicationState ==UIApplicationStateInactive){
NSLog(@"程序在运行状态"); }1234
4.阻止屏幕变暗进入休眠状态
//阻止屏幕变暗,慎重使用 缺省为no 2.0 [UIApplicationsharedApplication].idleTimerDisabled =YES;1234
(慎重使用本功能,因为非常耗电)
5.显示联网状态
//显示联网标记 2.0 [UIApplicationsharedApplication].networkActivityIndicatorVisible =YES;123
6.在map上显示一个地址
NSString* addressText =@”1 Infinite Loop Cupertino CA 95014”;
// URL encode the spaces
addressText = [addressTextstringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];12
NSString* urlText = [NSStringstringWithFormat:@”http://maps.google.com/maps?q=%@“ addressText];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:urlText]];12
7.发送电子邮件
NSString *recipients =@”mailto:first@example.com?cc=second@example.com third@example.com&subject=Hello from California!”;
NSString *body =@”&body=It is raining in sunny California!”;
NSString *email = [NSStringstringWithFormat:@"%@%@" recipients body]; email = [emailstringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [[UIApplicationsharedApplication]openURL:[NSURLURLWithString:email]];123456
8.打电话到一个号码
// Call Google 411 [[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"tel://8004664411"]];123
9.发送短信
// Text to Google SMS [[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"sms://466453"]];123
10.打开一个网址
// Lanuch any iPhone developers fav site
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@”http://itunesconnect.apple.com“]];
〖特别声明〗:本文内容仅供参考,不做权威认证,如若验证其真实性,请咨询相关权威专业人士。如有侵犯您的原创版权或者图片、等版权权利请告知 wzz#tom.com,我们将尽快删除相关内容。