- //定义AppDelegate类的对象 apd
- //然后利用下面的方法来使用这个对象,这样才能把值传到AppDelegate中
- self.apd = (AppDelegate*)[[UIApplication sharedApplication]delegate];
- //把这个类中的TextDb对象赋给 AppDelegate类中的TextDb对象
- self.apd.iTextDb = self.iTextDb;
//3.0以后引进,缺省YES
//阻止屏幕变暗,慎重使用,缺省为no 2.0
[UIApplicationsharedApplication].idleTimerDisabled =YES;
慎重使用本功能,因为非常耗电。
//显示联网标记 2.0
[UIApplicationsharedApplication].networkActivityIndicatorVisible =YES;
NSString* addressText =@"1 Infinite Loop, Cupertino, CA 95014";
// URL encode the spaces
addressText = [addressTextstringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString* urlText = [NSStringstringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:urlText]];
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]];
// Call Google 411
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"tel://8004664411"]];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"sms://466453"]];
// Lanuch any iPhone developers fav site
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"http://itunesconnect.apple.com"]];