我想用UIActionSheet为iOS8上,但它不赞成,我不知道如何使用更新的方式来使用这个......UIActionSheet上不再iOS8上
看到旧代码:
-(void)acoesDoController:(UIViewController *)controller{
self.controller = controller;
UIActionSheet *opcoes = [[UIActionSheet alloc]initWithTitle:self.contato.nome delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:@"other", nil];
[opcoes showInView:controller.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
//switch case of the buttons
}
为了清楚起见,在本例中,在UITableView索引中长按之后,激活操作表。
如何以正确的方式实现上面的代码?
对于未来的参考,如果你看一下[UIActionSheet]的文档(https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIActionSheet_Class/)它清楚地标记被废弃从iOS8开始,它甚至会告诉你什么是替换类。当你去[UIAlertController]的文档(https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAlertController_class/index.html#//apple_ref/occ/cl/UIAlertController)它甚至给你一个如何使用它的例子。学习阅读文档是改进的重要第一步。 – Abizern
感谢您的提示!我仍然以objective-c开始。 –