zoukankan      html  css  js  c++  java
  • iPhone控件之UIAlertView

    #import "UITestViewController.h"

    NSTimer *timer;

    @implementation UITestViewController

    - (void)hideAlert:(NSTimer *)sender
    {
    UIAlertView *alert = [sender userInfo];

    [alert dismissWithClickedButtonIndex:0 animated:YES];
    }

    - (void)viewDidLoad {

    [super viewDidLoad];

    UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"title"
    message:@"This alert will disappear in 3 seconds"
    delegate:self
    cancelButtonTitle:@"OK"
    otherButtonTitles:nil];

    [myAlert addButtonWithTitle:@"new button"];
    [myAlert addButtonWithTitle:@"another button"];

    [myAlert show];

    //create a timer to hide the alert automatically in 3 seconds
    timer = [[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(hideAlert:) userInfo:myAlert repeats:NO] retain];

    [myAlert release];
    }
  • 相关阅读:
    第二阶段站立会议03
    第二阶段站立会议02
    第二阶段站立会议01
    第十一周进度条
    小强大扫荡
    测试计划
    用户体验
    各组意见
    第一阶段绩效评估
    站立会议10
  • 原文地址:https://www.cnblogs.com/foxmin/p/2393607.html
Copyright © 2011-2022 走看看