zoukankan      html  css  js  c++  java
  • Displaying Alerts with UIAlertView

    UIAlertView *alertView = [[UIAlertView alloc]
                                initWithTitle:@"Alert"
                                message:@"You've been delivered an alert"
                                delegate:nil
                                cancelButtonTitle:@"Cancel"
                                otherButtonTitles:@"Ok", nil];
    [alertView show];

     self.view.backgroundColor = [UIColor whiteColor];

    NSString *message = @"Are you sure you want to open this link in Safari?";
    UIAlertView *alertView = [[UIAlertView alloc]
                                initWithTitle:@"Open Link"
                                message:message
                                delegate:self
                                cancelButtonTitle:[self noButtonTitle]
                                otherButtonTitles:[self yesButtonTitle], nil];
    [alertView show];

     more samples

    // one button alert
    UIAlertView *alert =
        [[UIAlertView alloc] 
        initWithTitle: @"Hello"
        message: @"Hello Master HaKu!"
        delegate: self
        cancelButtonTitle: @"OK"
        OtherButtonTitles: nil];
    [alert show];
    [alert release];
    
                                
    // two buttons alert
    UIAlertView *alert =
        [[UIAlertView alloc] 
        initWithTitle: @"Hello"
        message: @"Hello Master HaKu!"
        delegate: self
        cancelButtonTitle: @"YES"
        OtherButtonTitles: @"NO", nil];
    [alert show];
    [alert release];
    
                                
    // more buttons alert
    UIAlertView *alert =
        [[UIAlertView alloc] 
        initWithTitle: @"Hello"
        message: @"Hello Master HaKu!"
        delegate: self
        cancelButtonTitle: @"OK"
        OtherButtonTitles: @"Option1", @"Option2", nil];
    [alert show];
    [alert release];                            
    
    
    
    @interface AlertTestViewController : UIViewController<UIAlertViewDelegate>
    
    @end
    
    // alert click implmentation
    - (void) alertView: (UIAlertView *)alertView
    clickedButtonAtIndex: (NSInteger)buttonIndex
    {
        NSLog(@"%d", buttonIndex);
    }
  • 相关阅读:
    Mac下写博客工具ecto相关资料
    重装MacOS
    Mac下写博客工具MarsEdit相关资料
    Mac下安装最新版本的Graphviz
    什么是回归分析?
    Mac 配置Charles抓https的包
    Android sdk tool android 命令参数
    判断某个端口被那个进程占用
    [置顶] 微创新时代个人崛起的方法
    xml获取配置DataTable
  • 原文地址:https://www.cnblogs.com/davidgu/p/3461369.html
Copyright © 2011-2022 走看看