美文网首页
ios延迟的方法列举

ios延迟的方法列举

作者: 飞雨2013 | 来源:发表于2015-12-09 19:03 被阅读26次

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

- (IBAction)btnClick:(id)sender {

NSLog(@"laile");

UIAlertView *tempView = [[UIAlertView alloc] initWithTitle:@"" message:@"hello world" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];

[tempView show];

//1

//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

//        [tempView dismissWithClickedButtonIndex:0 animated:YES];

//    });

//    2

[self performSelector:@selector(createTimer:) withObject:tempView afterDelay:3];

}

- (void)createTimer:(UIAlertView *)tempView

{

[tempView dismissWithClickedButtonIndex:0 animated:YES];

}

@end

相关文章

网友评论

      本文标题:ios延迟的方法列举

      本文链接:https://www.haomeiwen.com/subject/rxtyhttx.html