效果图:
工程图:
注意:此文件要加入第三主库URBAlertView.
RootViewController.m
//点击任何处,出现提示框 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ URBAlertView *alertView = [URBAlertView dialogWithTitle:@"Test Dialog" subtitle:@"This is just a test dialog"]; alertView.blurBackground = NO; [alertView addButtonWithTitle:@"Close"]; [alertView addButtonWithTitle:@"OK"]; [alertView setHandlerBlock:^(NSInteger buttonIndex, URBAlertView *alertView) { NSLog(@"button tapped: index=%i", buttonIndex); [alertView hideWithCompletionBlock:^{ }]; }]; self.alertView = alertView; [self showDialogWithTumble]; } - (void)showDialog { [self.alertView showWithAnimation:URBAlertAnimationDefault]; } - (void)showDialogWithFade { [self.alertView showWithAnimation:URBAlertAnimationFade]; } - (void)showDialogWithFlipHorizontal { [self.alertView showWithAnimation:URBAlertAnimationFlipHorizontal]; } - (void)showDialogWithFlipVertical { [self.alertView showWithAnimation:URBAlertAnimationFlipVertical]; } - (void)showDialogWithTumble { [self.alertView showWithAnimation:URBAlertAnimationTumble]; } - (void)showDialogWithSlide { [self.alertView showWithAnimation:URBAlertAnimationSlideLeft]; }
源代码地址:http://url.cn/Ua2ztY
时间: 2025-01-17 23:39:49