UIAlertView
- (void)openWeiXin
{
//判断是否安装了微信
weiXinURL = [WXApigetWXAppInstallUrl];
BOOL isInstalled = [MHWeiXin checkWeiXinInstalled:&weiXinURL];
if (isInstalled)
{
[MHWeiXin sendTitle:@"掌上百科"
subTitle:nil
andImage:[UIImage imageNamed:@"icon.png"]
scene:WXSceneSession
complete:nil];
}
else
{
UIAlertView *errorAlert = [[UIAlertView alloc]initWithTitle:@"提示"
message:@"微信未安装,是否前往App Store下载安装"
delegate:self //这里不设置self的话下面的函数就不调用
cancelButtonTitle:@"取消"
otherButtonTitles:@"安装", nil];
errorAlert.tag = 100;
[errorAlert show];
[errorAlert release];
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == 100)
{
NSString *buttonTitle = [alertView buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"安装"])
{
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:weiXinURL]];
}
if ([buttonTitle isEqualToString:@"取消"])
{
}
}
}

浙公网安备 33010602011771号