Rom*_*zak 5 iphone objective-c uialertview ios
如何显示此警报视图?我知道我需要检查连接的可达性,但如何通过设置和确定按钮显示此警报?iOS 6我需要它.

不幸的是,在 iOS 5.1 及更高版本中,您无法从应用程序打开设置应用程序。
如果您使用的是较低版本,则以下内容将起作用。
创建警报视图,如下所示:
UIAlertView *cellularData = [[UIAlertView alloc] initWithTitle: @"Cellular Data is Turned Off" message:@"Turn on ellular data or use Wi-Fi to access data" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Settings", nil];
[cellularData show];
Run Code Online (Sandbox Code Playgroud)
实施clickedButtonAtIndex类似:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 1)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Network"]]
}
}
Run Code Online (Sandbox Code Playgroud)
它将从您的应用程序打开设置应用程序。
| 归档时间: |
|
| 查看次数: |
2196 次 |
| 最近记录: |