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);
    }
  • 相关阅读:
    node.js的安装与第一个hello world、node.js的初始化
    微信小程序组件学习中
    jq 滚轮监听事件
    数据库的优化(转)
    jquery zTree的基本用法
    Linux常用命令大全
    软件架构与设计 百度网盘的pdf电子书籍
    项目:IT资源共享资源(登录后端)<2>
    项目:IT资源共享资源(登录前端)<1>
    Node简单服务器开发
  • 原文地址:https://www.cnblogs.com/davidgu/p/3461369.html
Copyright © 2011-2022 走看看