当前位置:网站首页 > C++编程 > 正文

苹果手机出现object object_objectc

ios object-c 弹框功能

1、BaseViewController中

 BaseViewController.h 
@interface BaseViewController : UIViewController @end @interface BaseViewController (Alert) / 系统弹窗双选项 @param title 标题 @param message 文本内容 @param ok 确定 @param cancle 取消 @param OK 确定按钮回调 */ - (void)alertTitle:(NSString *)title andMessage:(NSString *)message andOK:(NSString*)ok andCancle:(NSString*)cancle andBlock:(void (^)(UIAlertAction *action))OK; / 系统弹窗单选项 @param title 标题 @param message 具体信息 @param handler 回调 */ - (void)alertTitle:(NSString*)title andMessage:(NSString*)message andCancleBlock:(void (^ __nullable)(UIAlertAction *action))handler; / 系统弹窗双选回调 @param title 标题 @param message 内容 @param ok ok @param cancle cancle @param OK ok回调 @param cancleBlock 取消回调 */ - (void)alertTitle:(NSString *)title andMessage:(NSString *)message andOK:(NSString*)ok andCancle:(NSString*)cancle andBlock:(void (^)(UIAlertAction *action))OK andCancleBlock:(void (^)(UIAlertAction *action))cancleBlock; @end 

BaseViewController.m

@interface BaseViewController () @end @implementation BaseViewController @end @implementation BaseViewController (Alert) - (void)alertTitle:(NSString *)title andMessage:(NSString *)message andCancleBlock:(void (^ __nullable)(UIAlertAction *action))handler { 
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:handler]; [alertController addAction:okAction]; [self presentViewController:alertController animated:YES completion:nil]; } - (void)alertTitle:(NSString *)title andMessage:(NSString *)message andOK:(NSString*)ok andCancle:(NSString*)cancle andBlock:(void (^)(UIAlertAction *action))OK { 
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:ok style:UIAlertActionStyleDestructive handler:OK]; [alertController addAction:okAction]; UIAlertAction *cancleAction = [UIAlertAction actionWithTitle:cancle style:UIAlertActionStyleDefault handler:nil]; [alertController addAction:cancleAction]; [self presentViewController:alertController animated:YES completion:nil]; } - (void)alertTitle:(NSString *)title andMessage:(NSString *)message andOK:(NSString*)ok andCancle:(NSString*)cancle andBlock:(void (^)(UIAlertAction *action))OK andCancleBlock:(void (^)(UIAlertAction *action))cancleBlock { 
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:ok style:UIAlertActionStyleDestructive handler:OK]; [alertController addAction:okAction]; UIAlertAction *cancleAction = [UIAlertAction actionWithTitle:cancle style:UIAlertActionStyleDefault handler:cancleBlock]; [alertController addAction:cancleAction]; [self presentViewController:alertController animated:YES completion:nil]; } @end 

2、使用弹框

#import "BaseViewController.h" @interface MineController : BaseViewController @end 
#import "MineController.h" @interface MineController () @end @implementation MineController - (IBAction)deleteButton:(id)sender { 
    @weakify(self); [self alertTitle:@"确定删除" andMessage:@"" andOK:@"确定" andCancle:@"取消" andBlock:^(UIAlertAction * _Nonnull action) { 
    @strongify(self); }]; } @end 
到此这篇苹果手机出现object object_objectc的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • C/C++后台研发需要点亮哪些技能树?学习路线规划2024-11-21 22:54:10
  • hologres开源_c++11 单例模式2024-11-21 22:54:10
  • sketch组件库如何导入和新建_美团旧版2024-11-21 22:54:10
  • objective c 教程_objectivec基础教程2024-11-21 22:54:10
  • C/C++后台研发需要点亮哪些技能树?学习路线规划2024-11-21 22:54:10
  • 全局变量在类中如何使用_objectivec和c语言2024-11-21 22:54:10
  • c语言中object指什么_Objective-C的特点2024-11-21 22:54:10
  • c++调用matlab生成的dll_OBJECT2024-11-21 22:54:10
  • swift和c++混编_objectc2024-11-21 22:54:10
  • object—c_c++编程软件是什么2024-11-21 22:54:10
  • 全屏图片