应用内调用邮箱/拨号/短信/浏览器/应用商店

相关链接


752372-20160427165618064-1244110130.png

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark 邮箱点击事件
- (IBAction)urlButtonClick:(UIButton *)sender {

    NSString *url = @"mailto:[email protected]";
    [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
}

#pragma mark 短信点击事件
- (IBAction)duanXinClick:(UIButton *)sender {

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:13718047581"]];

}

#pragma mark 拨号点击事件
- (IBAction)boHaoClick:(UIButton *)sender {

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://13718047581"]];
}

#pragma mark 浏览器点击
- (IBAction)liuLanQiClick:(UIButton *)sender {

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mqqwpa://im/chat?chat_type=wpa&uin=3108145465&version=1&src_type=web&web_src=oicqzone.com"]];
}

#pragma mark 谷歌地图点击
- (IBAction)googleMapClick:(UIButton *)sender {

    NSString* addressText=@"1 Infinite Loop, Cupertino, CA 95014";
    addressText = [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
    NSString* urlText =[NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
}

#pragma mark 应用商店点击
- (IBAction)appStoreClick:(UIButton *)sender {

    NSURL*appStoreUrl= [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8"];
    [[UIApplication sharedApplication] openURL:appStoreUrl];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

猜你喜欢

转载自blog.csdn.net/github_33467146/article/details/81064661