美文网首页
弹出提示框

弹出提示框

作者: 彼岸的黑色曼陀罗 | 来源:发表于2016-09-06 19:08 被阅读0次

    方式一:底部弹出提示框(UIActionSheet)

    • 调用initWithTitle:delegate:cancelButtonTitle:取消destructiveButtonTitle:确定otherButtonTitle:
    • showInView:self.view
    • 遵守协议<UIActionSheetDelegate>
    • 实现代理方法
      • clickButtonAtIndex:当buttonIndex == 0时,返回到上一级

    方式二:中间弹出(UIAlertView)

    • 调用initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:
    • show

    方式三:UIAlertController(可以实现上面两种效果)

    • 创建控制器

      • alertControllerWithTitle:message:preferredStyle:弹出指定的样式
    • 创建按钮 UIAlertAction
      -点击按钮的时候会调用这个方法 ,可以做pop操作。actionWithTitle:style:handler:^(){}

    • 把按钮添加到控制器上,有几个添加几个addAction

    • 弹框modal形式弹出

      • presentViewController:animated:completion:
    • 注意:只有alert样式的时候,才可以添加文本框。

    相关文章

      网友评论

          本文标题:弹出提示框

          本文链接:https://www.haomeiwen.com/subject/wendettx.html