UIAlertView格式备忘

用tag区别各个AlertView

typedef NS_ENUM(NSInteger, UIAlertTag)
{
    AlertTag1,
    AlertTag2,
    AlertTag3
};

使用UIAlertViewDelegate协议

@interface UIViewController ()<UIAlertViewDelegate>

@end

使用AlertView

@implementation UIViewController
UIAlertView *alertView = [[UIAlertView alloc]
                              initWithTitle:title
                              message:message
                              delegate:self
                              cancelButtonTitle:leftString
                              otherButtonTitles:rightString, nil];
alertView.tag = tag;
[alertView show];

实现代理

#pragma mark - UIAlertView delegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if(buttonIndex == 0){
        
    }
}

@end
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,981评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,466评论 25 708
  • *面试心声:其实这些题本人都没怎么背,但是在上海 两周半 面了大约10家 收到差不多3个offer,总结起来就是把...
    Dove_iOS阅读 27,216评论 30 472
  • 1. Java基础部分 基础部分的顺序:基本语法,类相关的语法,内部类的语法,继承相关的语法,异常的语法,线程的语...
    子非鱼_t_阅读 31,767评论 18 399
  • 你是手机控吗?手机每天占有了你几个小时? 1. 班级里有几个漂亮的女生在上课的时候,总在桌子前放上自己那大大的包,...
    绚之平淡阅读 1,786评论 4 14