DXAlertViewDemo

时间:2014-10-27 12:30:42   收藏:0   阅读:223

效果图:

bubuko.com,布布扣

工程图:

bubuko.com,布布扣

此工程要引入第三方库DXAlertView

 

RootViewController.m

//点击任何处,出现提示框
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self twoBtnClicked];
}

- (void)twoBtnClicked
{
    DXAlertView *alert = [[DXAlertView alloc] initWithTitle:@"Congratulations" contentText:@"You have bought something" leftButtonTitle:@"Ok" rightButtonTitle:@"Fine"];
    [alert show];
    alert.leftBlock = ^() {
        NSLog(@"left button clicked");
    };
    alert.rightBlock = ^() {
        NSLog(@"right button clicked");
    };
    alert.dismissBlock = ^() {
        NSLog(@"Do something interesting after dismiss block");
    };
}

- (void)OneBtnClicked
{
    DXAlertView *alert = [[DXAlertView alloc] initWithTitle:@"Congratulations" contentText:@"You have bought something" leftButtonTitle:nil rightButtonTitle:@"Fine"];
    [alert show];
    alert.rightBlock = ^() {
        NSLog(@"right button clicked");
    };
    alert.dismissBlock = ^() {
        NSLog(@"Do something interesting after dismiss block");
    };
}

 

源代码地址:http://url.cn/OlsJ8E

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!