• alertview 使用


    typedef enum{

    alertviewType1,

    alertviewType2,

    } alertviewType;

    @interface ZBMainViewController ()<UIAlertViewDelegate>

    @end

    @implementation ZBMainViewController

    - (void)viewDidLoad

    {

        [super viewDidLoad];

        

        //导航栏是否透明  no是透明

        

        [self.navigationController.navigationBar setTranslucent:NO];

         self.navigationItem.title = @"张先森";   //    self.title=@"张先森";

        

        [self.navigationController.navigationBar setBarTintColor:[UIColor purpleColor]];

        [self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"测试" style:UIBarButtonItemStyleDone target:self action:@selector(leftClick:)]];

    }

    -(void)leftClick:(UIBarButtonItem *)item{

        UIAlertView *view=[[UIAlertView alloc] initWithTitle:@"测试" message:@"你大爷" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"yes", nil];

         view.tag=alertviewType1;

        [view show];

    }

    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

        if (alertView.tag==alertviewType1) {

            

            if (buttonIndex==0) {

                

            }

            

            

            

        }

    }

     6   UIAlertView *altView = [[UIAlertView alloc]initWithTitle:[self altTitle] message:[self altMSG] delegate:self cancelButtonTitle:[self cancelBtnTitle] otherButtonTitles:[self otherBtnTitle], nil];
    7     // 2、显示 alertView
    8     [altView show];

     22 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    23 {
    24     NSString *btnTitle = [alertView buttonTitleAtIndex:buttonIndex];
    25     if ([btnTitle isEqualToString:[self cancelBtnTitle]]) {
    26         NSLog(@"你点击了退出");
    27     }
    28     else if ([btnTitle isEqualToString:[self otherBtnTitle]] ) {
    29         NSLog(@"你点击了重新登录按钮");
    30     }
    31 }

  • 相关阅读:
    JavaScript作用域学习笔记
    Object.prototype.toString.call() 区分对象类型
    oracle 经典SQL整理
    day31
    ID3决策树
    C# 中浅拷贝与深拷贝区别
    C#值类型和引用类型的区别
    C#守护进程(windows服务)
    C#线程池
    C#双缓冲绘图
  • 原文地址:https://www.cnblogs.com/zhibin/p/4114554.html
Copyright © 2020-2023  润新知