效果图:
工程图:
此工程需要导入第三方,AMSmoothAlert
RootViewController.m
//点击任何处,出现提示框 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { alert = [[AMSmoothAlertView alloc]initDropAlertWithTitle:@"Congrats !" andText:@"You‘ve just displayed this awesome alert view !" andCancelButton:NO forAlertType:AlertSuccess]; [alert.defaultButton setTitle:@"Great" forState:UIControlStateNormal]; alert.completionBlock = ^void (AMSmoothAlertView *alertObj, UIButton *button) { if(button == alertObj.defaultButton) { NSLog(@"Default"); } else { NSLog(@"Others"); } }; alert.cornerRadius = 3.0f; [alert show]; }
源代码地址:
时间: 2024-11-07 11:33:30