• 关于UIAlertView使用的一些注意事项


    首先我们要支持协议,在.h文件内添加协议

    #import <UIKit/UIKit.h>
    @interface ViewController : UIViewController<UIAlertViewDelegate>
    @property(retain,nonatomic)UIAlertView *alertV,*alertV2;

    我们在对提示框内各按键进行设定时,要注意,如果一个case里面有多句,要加上{}

    //设置提示窗口的各按钮的功能
    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
        //如果有多个提示窗口,那么不同提示窗口的按钮功能可能不用,这时候要判断一下是哪个提是窗口,再对哪个提示窗口进行我们需要对它实现的功能
        if (alertView==self.alertV) {
            switch (buttonIndex) {
                case 0:
                {   //注意不只一句的时候要加{}
                    //跳转界面
                    MainViewController* fanhui=[[[MainViewController alloc]init]autorelease];
                    [self presentViewController:fanhui animated:YES completion:nil];
                    break;
    
                }
               case 1:
                {
                    Lv2ViewController *next=[[[Lv2ViewController alloc]init]autorelease];
                    [self presentViewController:next animated:YES completion:nil];
                    break;
                }
                    
                default:
                    break;
            }
        }
        else{
            switch (buttonIndex) {
                case 0:
                {
                    MainViewController *fanhui=[[[MainViewController alloc]init]autorelease];
                    [self presentViewController:fanhui animated:YES completion:nil];
                    break;
                }
                case 1:
                {
                    ViewController *chongshi=[[[ViewController alloc]init]autorelease];
                    [self presentViewController:chongshi animated:YES completion:nil];
                    break;
                }
                    
                default:
                    break;
            }
        }
    
    
    }
  • 相关阅读:
    duplicate symbols for architeture arm64 linker command failed with code 1(use-c to see invocation)
    Operation not permitted
    [笔试]常考算法
    过滤ST/退市股票
    python动态调用函数
    dataFrame 切片操作
    DataFrame概念与创建
    DataFrame 加减乘除
    DataFrame查找
    DataFrame操作
  • 原文地址:https://www.cnblogs.com/amoy888/p/3396431.html
Copyright © 2020-2023  润新知