zoukankan      html  css  js  c++  java
  • 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 }

  • 相关阅读:
    数组返回NULL绕过
    69.x的平方根
    1277.统计全为1的正方形子矩形
    221.最大正方形
    572.另一个树的子树
    983.最低票价
    98.验证二叉排序树
    53.最大子序和
    5386.检查一个字符串是否可以打破另一个字符串
    5385.改变一个整数能得到的最大差值
  • 原文地址:https://www.cnblogs.com/zhibin/p/4114554.html
Copyright © 2011-2022 走看看