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;
            }
        }
    
    
    }
  • 相关阅读:
    GOIP connects with Elastix through “config by line”
    Asterisk 的安全性
    sql2005性能优化(在32位系统上突破2G内存使用量的方法) .
    Asterisk的type类型和身份认证
    Elastix GOIP 网关配合
    Elastix 安装G729 G723语音编码
    Delegate,Action,Func,匿名方法,匿名委托,事件 (转载)
    Proxmox Reset Root Password
    volatile适用场景
    ANT教程经典
  • 原文地址:https://www.cnblogs.com/amoy888/p/3396431.html
Copyright © 2011-2022 走看看