zoukankan      html  css  js  c++  java
  • 关于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;
            }
        }
    
    
    }
  • 相关阅读:
    为linux系统添加虚拟内存swap分区
    使用exec命令删除前几天产生的日志
    编写脚本:访问一网站,每5分钟访问一次,如果访问成功,将访问记录保存到日志,如果访问失败,则发送邮件至指定邮箱
    html,css学习实践总结
    css清除浮动
    bootstrap简单使用
    jquery笔记
    HTML,CSS笔记
    node学习: package.json
    node笔记
  • 原文地址:https://www.cnblogs.com/amoy888/p/3396431.html
Copyright © 2011-2022 走看看