UIAlertView是系统为我们封装好的一个提示框,会弹出在屏幕的中间位置,有可选择的按钮,我们只需要创建它,并写上提示内容就可以了,非常方便,(iOS8之后这个方法已经被弃用,用UIAlertController替代,
当我们设置多个button的时候,取消的button总是在最后一个,其它的会按顺序排列
UIAlertController继承与UIViewController,用于替代UIAlertView和UIActionSheet,iOS8之后才有的
)
一,UIAlertView简单用法
UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"提示" message:@"欢迎回来" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", @"再来一次", @"哈哈", nil];
alter.tag = 100;
[alter addButtonWithTitle:@"12"];
[alter show];
[alter release];
本文深入探讨了UIAlertView和UIAlertController的使用方法,包括简单用法、替代关系及注意事项。详细解析了如何创建提示框、添加按钮及处理响应。
138

被折叠的 条评论
为什么被折叠?



