专题 UIAlertController |
|
// iOS8之前 // UIAlertView // UIActionSheet; // iOS8开始 // UIAlertController == UIAlertView + UIActionSheet UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; // 添加按钮 [alert addAction:[UIAlertAction actionWithTitle:@"收藏" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { XMGLog(@"点击了[收藏]"); }]]; [alert addAction:[UIAlertAction actionWithTitle:@"举报" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { XMGLog(@"点击了[举报]"); }]]; [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { XMGLog(@"点击了[取消]"); }]]; [self.window.rootViewController presentViewController:alert animated:YES completion:nil];
|
|