在我的WatchKit应用中,当用户首次启动该应用时,我想向他们显示一条有用的消息警报,告诉他们该应用的工作方式,例如按钮的作用等
我可以在WatchKit应用程序中调用类似于UIAlertView/UIAlertController的东西吗?我找不到关于该主题的答案,这很可能意味着这是不可能的。
最佳答案
(watchOS 2.0的新功能)
WKAlertAction *act = [WKAlertAction actionWithTitle:@"OK" style:WKAlertActionStyleCancel handler:^(void){
NSLog(@"ALERT YES ");
}];
NSArray *testing = @[act];
[self presentAlertControllerWithTitle:@"Voila" message:@"This is Watch OS 2 !" preferredStyle:WKAlertControllerStyleAlert actions:testing];
迅速
func showPopup(){
let h0 = { print("ok")}
let action1 = WKAlertAction(title: "Approve", style: .default, handler:h0)
let action2 = WKAlertAction(title: "Decline", style: .destructive) {}
let action3 = WKAlertAction(title: "Cancel", style: .cancel) {}
presentAlert(withTitle: "Voila", message: "", preferredStyle: .actionSheet, actions: [action1,action2,action3])
}