本文将介绍可可–等待[NSAlertbeginSheetModalForWindow:…];的详细情况,特别是关于可可的等待的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主
本文将介绍可可 – 等待[NSAlert beginSheetModalForWindow:…];的详细情况,特别是关于可可的等待的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于A modular InnoSetup script to download and install all available .NET Framework versions and much mo、BAAlert BAAlert_OC.hBAAlert.hBAActionSheet.hdemo 示例 iOS alert 和 actionSheet 的封装、BlockAlertsAnd-ActionSheets、Cocoa:在NSApp beginSheet结果隐藏主窗口后显示错误的知识。
本文目录一览:- 可可 – 等待[NSAlert beginSheetModalForWindow:…];(可可的等待)
- A modular InnoSetup script to download and install all available .NET Framework versions and much mo
- BAAlert BAAlert_OC.hBAAlert.hBAActionSheet.hdemo 示例 iOS alert 和 actionSheet 的封装
- BlockAlertsAnd-ActionSheets
- Cocoa:在NSApp beginSheet结果隐藏主窗口后显示错误
可可 – 等待[NSAlert beginSheetModalForWindow:…];(可可的等待)
int response; NSAlert *alert = [NSAlert alertWithMessageText:... ...]; response = [alert runModal];
问题是这是应用程序模式,我的应用程序是基于文档的。我在当前文档的窗口中使用表单显示警报,如下所示:
int response; NSAlert *alert = [NSAlert alertWithMessageText:... ...]; [alert beginSheetModalForWindow:aWindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:&response]; //elsewhere - (void) alertDidEnd:(NSAlert *) alert returnCode:(int) returnCode contextInfo:(int *) contextInfo { *contextInfo = returnCode; }
唯一的问题是beginSheetModalForWindow:立即返回,所以我无法可靠地向用户询问一个问题并等待响应。如果我可以将任务分成两个方面,但我不能这样做,这不是什么大不了的事情。
我有一个循环来处理大约40个不同的对象(在树中)。如果一个对象发生故障,我希望该提醒显示并询问用户是否继续或中止(在当前分支继续处理),但是由于我的应用程序是基于文档的,所以“Apple人机界面指南”规定在警报为特定于文件。
如何显示提醒表并等待响应?
解决方法
不知道有关您的实际设计和处理这些对象的任何信息,很难给出任何进一步的信息。不过,我的头顶上,有几个想法可能是:
>通过某种运行循环信号或队列处理与主线程通信的另一个线程中的对象。如果窗口的对象树中断,它会向主线程通知它被中断,并等待来自主线程的信号,并提供有关该做什么的信息(继续此分支或中止)。然后,主线程将显示文档模态窗口,并在用户选择要执行的操作之后发信号通知进程线程。
但是,对于您需要,这可能真的过于复杂。在这种情况下,我的建议将是使用不推荐使用的方法,但这取决于您的用户需求。
A modular InnoSetup script to download and install all available .NET Framework versions and much mo
总结
以上是小编为你收集整理的A modular InnoSetup script to download and install all available .NET Framework versions and much mo全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
BAAlert BAAlert_OC.hBAAlert.hBAActionSheet.hdemo 示例 iOS alert 和 actionSheet 的封装
BAAlert BAAlert_OC.hBAAlert.hBAActionSheet.hdemo 示例 介绍
BAAlert
1、功能及简介
-
1、手势触摸隐藏开关,可随时开关
-
2、可以自定义背景图片、背景颜色、按钮颜色
- 3、可以添加文字和图片,且可以滑动查看!
- 4、横竖屏适配完美,注意:自定义 alert 不支持横屏
- 5、有各种炫酷动画展示你的 alert
- 6、可以自定义每个按钮颜色
2、图片示例
3、安装、导入示例和源码地址
- 1、pod 导入【最新版本:
】:
pod ''BAAlert'' pod ''BAAlert-Swift''
如果发现 pod search BAAlert 搜索出来的不是最新版本,需要在终端执行 cd 转换文件路径命令退回到 desktop,然后执行 pod setup 命令更新本地spec缓存(可能需要几分钟),然后再搜索就可以了。
具体步骤:
- pod setup : 初始化
- pod repo update : 更新仓库
- pod search BAAlert
* 2、文件夹拖入:下载demo,把 BAAlert 文件夹拖入项目即可,
- 3、导入头文件:
#import "BAAlert_OC.h"
- 4、项目源码地址:
OC 版 :https://github.com/BAHome/BAAlert
swift 版 :https://github.com/BAHome/BAAlert-
Swift
4、BAAlert 的类结构及 demo 示例
BAAlert_OC.h
#ifndef BAAlert_OC_h #define BAAlert_OC_h #import "BAAlert.h" #import "BAActionSheet.h" #import "BAKit_ConfigurationDefine.h" /*! ********************************************************************************* ************************************ 更新说明 ************************************ ********************************************************************************* 欢迎使用 BAHome 系列开源代码 ! 如有更多需求,请前往:https://github.com/BAHome 项目源码地址: OC 版 :https://github.com/BAHome/BAAlert 最新更新时间:2017-06-23 【倒叙】 最新Version:【Version:1.2.2】 更新内容: 1.2.2.1、优化部分宏定义 最新更新时间:2017-06-19 【倒叙】 最新Version:【Version:1.2.0】 更新内容: 1.2.0.1、统一全局宏定义文件,优化代码规范 最新更新时间:2017-05-20 【倒叙】 最新Version:【Version:1.1.9】 更新内容: 1.1.9.1、修复动画过度白屏问题 最新更新时间:2017-05-15 【倒叙】 最新Version:【Version:1.1.8】 更新内容: 1.1.8.1、精简代码结构,删除多余或者重复代码 1.1.8.2、规范代码属性和方法命名,原有方法名和属性名有较大改动,忘见谅 1.1.8.3、重构 actionSheet,新增多种样式 最新更新时间:2017-05-13 【倒叙】 最新Version:【Version:1.1.7】 更新内容: 1.1.7.1、精简代码结构,删除多余或者重复代码 1.1.7.2、规范代码属性和方法命名,原有方法名和属性名有较大改动,忘见谅 1.1.7.3、优化部分动画 1.1.7.4、subView 布局优化 1.1.7.5、actionSheet 新增自定义文字颜色、title 字体颜色 最新更新时间:2017-05-10 【倒叙】 最新Version:【Version:1.1.5】 更新内容: 1.1.5.1、删除原有封装内部按钮点击事件中 ba_dismissAlertView 方法,此方法可在外部自由调用 最新更新时间:2017-05-09 【倒叙】 最新Version:【Version:1.1.4】 更新内容: 1.1.4.1、pod 更新xib 文件 最新更新时间:2017-05-08 【倒叙】 最新Version:【Version:1.1.0】 更新内容: 1.1.0.1、优化方法名命名规范 1.1.0.2、新增键盘内部处理 1.1.0.3、用原生 autoLayout 重构,自定义 alert 的布局再也不是问题了 1.1.0.4、优化代码结构,修复内在隐藏内存泄漏 1.1.0.5、新增 BAAlert_OC.h 文件,只需导入 BAAlert_OC.h 一个文件就可以使用 alert 和 actionSheet 了 1.1.0.6、删除了部分代码和属性,具体见源码 和 demo */ #endif /* BAAlert_OC_h */
BAAlert.h
#import #import "BAAlert_Config.h" @class BAAlert; typedef void(^BAAlert_ConfigBlock)(BAAlert *tempView); @interface BAAlert : UIView /*! 背景颜色 默认:半透明*/ @property (nonatomic, strong) UIColor *bgColor; /*! 是否开启边缘触摸隐藏 alert 默认:NO */ @property (nonatomic, assign) BOOL isTouchEdgeHide; /*! 背景图片名字 默认:没有图片*/ @property (nonatomic, strong) Nsstring *bgImageName; /*! 是否开启进出场动画 默认:NO,如果 YES ,并且同步设置进出场动画枚举为默认值:1 */ @property (nonatomic, assign, getter=isShowAnimate) BOOL showAnimate; /*! 进出场动画枚举 默认:1 ,并且默认开启动画开关 */ @property (nonatomic, assign) BAAlertAnimatingStyle animatingStyle; /*! 背景高斯模糊枚举 默认:没有模糊效果 */ @property (nonatomic, assign) BAAlertBlurEffectStyle blurEffectStyle; /*! * 创建一个完全自定义的 alertView,注意:【自定义 alert 只适用于竖屏状态!】 * * @param customView 自定义 View * @param configuration 属性配置:如 bgColor、buttonTitleColor、isTouchEdgeHide... */ \+ (void)ba_alertShowCustomView:(UIView *)customView configuration:(BAAlert_ConfigBlock) configuration; /*! * 创建一个类似于系统的alert * * @param title 标题:可空 * @param message 消息内容:可空 * @param image 图片:可空 * @param buttonTitleArray 按钮标题:不可空 * @param buttonTitleColorArray 按钮标题颜色:可空,默认蓝色 * @param configuration 属性配置:如 bgColor、buttonTitleColor、isTouchEdgeHide... * @param actionBlock 按钮的点击事件处理 */ \+ (void)ba_alertShowWithTitle:(Nsstring *)title message:(Nsstring *)message image:(UIImage *)image buttonTitleArray:(NSArray *)buttonTitleArray buttonTitleColorArray:(NSArray *)buttonTitleColorArray configuration:(BAAlert_ConfigBlock)configuration actionBlock:(BAAlert_ButtonActionBlock)actionBlock; /*! * 视图消失 */ \- (void)ba_alertHidden; @end
BAActionSheet.h
#import #import "BAAlert_Config.h" @class BAActionSheet, BAActionSheetModel; typedef void(^BAActionSheet_ConfigBlock)(BAActionSheet *tempView); typedef void (^BAActionSheet_ActionBlock)(NSIndexPath *indexPath, BAActionSheetModel *model); @interface BAActionSheet : UIView /*! 是否开启边缘触摸隐藏 alert 默认:YES */ @property (nonatomic, assign) BOOL isTouchEdgeHide; /*! 是否开启进出场动画 默认:NO,如果 YES ,并且同步设置进出场动画枚举为默认值:1 */ @property (nonatomic, assign, getter=isShowAnimate) BOOL showAnimate; /*! 进出场动画枚举 默认:1 ,并且默认开启动画开关 */ @property (nonatomic, assign) BAAlertAnimatingStyle animatingStyle; /*! BAActionSheet 类型,默认:1 */ @property (nonatomic, assign) BAActionSheetType actionSheetType; @property (nonatomic, strong) NSArray *dataArray; @property (nonatomic, strong) Nsstring *title; /*! * * @param configuration 属性配置:如 bgColor、buttonTitleColor、isTouchEdgeHide... * @param actionBlock block回调点击的选项 */ \+ (void)ba_actionSheetShowWithConfiguration:(BAActionSheet_ConfigBlock)configuration actionBlock:(BAActionSheet_ActionBlock)actionBlock; /*! * 隐藏 BAActionSheet */ \- (void)ba_actionSheetHidden; @end @class BAActionSheetSubContentModel; @interface BAActionSheetModel : NSObject @property(nonatomic, copy) Nsstring *imageUrl; @property(nonatomic, copy) Nsstring *content; @property(nonatomic, copy) Nsstring *subContent; @property(nonatomic, strong) NSArray *subContentArray; @end @interface BAActionSheetSubContentModel : NSObject @property(nonatomic, copy) Nsstring *subContent; @end
demo 示例
\- (void)actionSheet1 { NSMutableArray *dataArray = [NSMutableArray array]; NSArray *contentArray = @[@"微信支付", @"支付宝", @"预付款账户"]; NSArray *subContentArray = @[@"", @"18588888888", @"余额:¥480.00"]; NSArray *imageArray = @[@"123.png", @"背景.jpg", @"美女.jpg"]; for (NSInteger i = 0; i < contentArray.count; i++) { BAActionSheetModel *model = [BAActionSheetModel new]; model.imageUrl = imageArray[i]; model.content = contentArray[i]; model.subContent = subContentArray[i]; [dataArray addobject:model]; } BAKit_WeakSelf [BAActionSheet ba_actionSheetShowWithConfiguration:^(BAActionSheet *tempView) { BAKit_StrongSelf tempView.title = @"支付方式"; tempView.dataArray = dataArray; tempView.isTouchEdgeHide = NO; tempView.showAnimate = YES; self.actionSheet = tempView; } actionBlock:^(NSIndexPath *indexPath, BAActionSheetModel *model) { BAKit_ShowAlertWithMsg_ios8(model.content); }]; } \- (void)actionSheet2 { NSMutableArray *dataArray = [NSMutableArray array]; NSArray *contentArray = @[@"微信支付", @"支付宝", @"预付款账户"]; for (NSInteger i = 0; i < contentArray.count; i++) { BAActionSheetModel *model = [BAActionSheetModel new]; // model.imageUrl = imageArray[i]; model.content = contentArray[i]; // model.subContent = subContentArray[i]; [dataArray addobject:model]; } BAKit_WeakSelf [BAActionSheet ba_actionSheetShowWithConfiguration:^(BAActionSheet *tempView) { BAKit_StrongSelf // tempView.title = @"支付方式"; tempView.dataArray = dataArray; tempView.actionSheetType = BAActionSheetTypeCustom; // tempView.isTouchEdgeHide = NO; self.actionSheet = tempView; } actionBlock:^(NSIndexPath *indexPath, BAActionSheetModel *model) { BAKit_ShowAlertWithMsg_ios8(model.content); }]; } \- (void)actionSheet3 { NSArray *contentArray = @[@"微信支付", @"支付宝", @"预付款账户", @"中行"]; NSArray *subContentArray = @[ @[@"微信支付1", @"微信支付2", @"微信支付3"], @[@"支付宝1", @"支付宝2", @"支付宝3", @"支付宝4"], @[], @[@"中行1", @"中行2", @"中行3", @"中行4", @"中行5", @"中行6", @"中行7", @"中行2", @"中行3", @"中行4", @"中行5", @"中行6", @"中行7", @"中行2", @"中行3", @"中行4", @"中行5", @"中行6", @"中行7", @"中行2", @"中行3", @"中行4", @"中行5", @"中行6", @"中行7"] ]; NSMutableArray *dataArray = @[].mutablecopy; for (NSInteger i = 0; i < contentArray.count; i++) { BAActionSheetModel *model = [BAActionSheetModel new]; model.content = contentArray[i]; NSMutableArray *mutArray = @[].mutablecopy; for (NSInteger j = 0; j < subContentArray[i].count; j ++) { BAActionSheetSubContentModel *subContentModel = [BAActionSheetSubContentModel new]; subContentModel.subContent = subContentArray[i][j]; [mutArray addobject:subContentModel]; } model.subContentArray = mutArray; [dataArray addobject:model]; } BAKit_WeakSelf [BAActionSheet ba_actionSheetShowWithConfiguration:^(BAActionSheet *tempView) { BAKit_StrongSelf tempView.title = @"支付方式"; tempView.dataArray = dataArray; tempView.actionSheetType = BAActionSheetTypeExpand; // tempView.isTouchEdgeHide = NO; self.actionSheet = tempView; } actionBlock:^(NSIndexPath *indexPath, BAActionSheetModel *model) { if (model.subContentArray.count > 0) { BAKit_ShowAlertWithMsg_ios8(model.subContentArray[indexPath.row].subContent); } else { BAKit_ShowAlertWithMsg_ios8(model.content); } }]; } \- (void)alert1 { BAKit_WeakSelf /*! 第一种封装使用示例 */ [BAAlert ba_alertShowWithTitle:title0 message:titleMsg0 image:nil buttonTitleArray:@[@"取消",@"确定",@"确定2",@"确定3"] buttonTitleColorArray:@[[UIColor redColor], [UIColor greenColor], [UIColor grayColor], [UIColor purpleColor]] configuration:^(BAAlert *tempView) { BAKit_StrongSelf // temp.bgColor = [UIColor colorWithRed:0 green:1.0 blue:0 alpha:0.3]; /*! 开启边缘触摸隐藏alertView */ tempView.isTouchEdgeHide = YES; /*! 添加高斯模糊的样式 */ tempView.blurEffectStyle = BAAlertBlurEffectStyleLight; /*! 开启动画 */ tempView.showAnimate = YES; // /*! 进出场动画样式 默认为:1 */ // tempView.animatingStyle = 1; self.alertView1 = tempView; } actionBlock:^(NSInteger index) { BAKit_StrongSelf [self.alertView1 ba_alertHidden]; if (index == 1) { NSLog(@"点击了确定按钮!"); ViewController2 *vc2 = [ViewController2 new]; vc2.title = @"alert1"; [self.navigationController pushViewController:vc2 animated:YES]; } }]; } \- (void)alert2 { // /*! 2、自定义按钮颜色 */ BAKit_WeakSelf [BAAlert ba_alertShowWithTitle:@"温馨提示:" message:titleMsg2 image:nil buttonTitleArray:@[@"取消", @"跳转VC2"] buttonTitleColorArray:@[[UIColor redColor], [UIColor greenColor]] configuration:^(BAAlert *tempView) { BAKit_StrongSelf /*! 自定义按钮文字颜色 */ // tempView.buttonTitleColor = [UIColor orangeColor]; tempView.bgColor = [UIColor colorWithRed:1.0 green:1.0 blue:0 alpha:0.3]; tempView.isTouchEdgeHide = YES; /*! 是否开启进出场动画 默认:NO,如果 YES ,并且同步设置进出场动画枚举为默认值:1 */ tempView.showAnimate = YES; tempView.animatingStyle = BAAlertAnimatingStyleShake; self.alertView2 = tempView; } actionBlock:^(NSInteger index) { BAKit_StrongSelf [self.alertView2 ba_alertHidden]; if (index == 0) { NSLog(@"点击了取消按钮!"); } else if (index == 1) { NSLog(@"点击了确定按钮!"); ViewController2 *vc2 = [ViewController2 new]; vc2.title = @"alert2"; [self.navigationController pushViewController:vc2 animated:YES]; } }]; } \- (void)alert3 { /*! 3、自定义背景图片 */ BAKit_WeakSelf [BAAlert ba_alertShowWithTitle:@"温馨提示:" message:titleMsg1 image:nil buttonTitleArray:@[@"取消", @"确定"] buttonTitleColorArray:@[[UIColor redColor], [UIColor greenColor]] configuration:^(BAAlert *tempView) { BAKit_StrongSelf /*! 自定义按钮文字颜色 */ // tempView.buttonTitleColor = [UIColor orangeColor]; /*! 自定义alert的背景图片 */ tempView.bgImageName = @"背景.jpg"; /*! 开启动画,并且设置动画样式,默认:1 */ // tempView.showAnimate = YES; /*! 没有开启动画,直接进出场动画样式,默认开启动画 */ tempView.animatingStyle = BAAlertAnimatingStyleFall; self.alertView3 = tempView; } actionBlock:^(NSInteger index) { BAKit_StrongSelf [self.alertView3 ba_alertHidden]; if (index == 0) { NSLog(@"点击了取消按钮!"); } else if (index == 1) { NSLog(@"点击了确定按钮!"); ViewController2 *vc2 = [ViewController2 new]; vc2.title = @"alert3"; [self.navigationController pushViewController:vc2 animated:YES]; } }]; } \- (void)alert4 { /*! 4、内置图片和文字,可滑动查看 */ BAKit_WeakSelf [BAAlert ba_alertShowWithTitle:@"温馨提示:" message:titleMsg1 image:[UIImage imageNamed:@"美女.jpg"] buttonTitleArray:@[@"取消", @"跳转VC2"] buttonTitleColorArray:@[[UIColor redColor], [UIColor greenColor]] configuration:^(BAAlert *tempView) { BAKit_StrongSelf /*! 自定义按钮文字颜色 */ // tempView.buttonTitleColor = [UIColor orangeColor]; /*! 自定义alert的背景图片 */ tempView.bgImageName = @"背景.jpg"; /*! 是否显示动画效果 */ tempView.showAnimate = YES; self.alertView4 = tempView; } actionBlock:^(NSInteger index) { BAKit_StrongSelf [self.alertView4 ba_alertHidden]; if (index == 0) { NSLog(@"点击了取消按钮!"); } else if (index == 1) { NSLog(@"点击了确定按钮!"); ViewController2 *vc2 = [ViewController2 new]; vc2.title = @"alert4"; [self.navigationController pushViewController:vc2 animated:YES]; } }]; } \- (void)alert5 { /*! 5、完全自定义alert */ _customView = [CustomView new]; self.customView.frame = CGRectMake(50, SCREENHEIGHT - 300, SCREENWIDTH - 50 * 2, 162); BAKit_WeakSelf [BAAlert ba_alertShowCustomView:self.customView configuration:^(BAAlert *tempView) { BAKit_StrongSelf tempView.isTouchEdgeHide = YES; tempView.animatingStyle = BAAlertAnimatingStyleScale; self.alertView5 = tempView; }]; self.customView.block = ^(NSInteger index) { BAKit_StrongSelf if (index == 1) { [self.alertView5 ba_alertHidden]; } }; } 其他示例可下载demo查看源码!
5、更新记录:【倒叙】
欢迎使用 【BAHome】 系列开源代码 !
如有更多需求,请前往:【https://github.com/BAHome】
最新更新时间:2017-06-23 【倒叙】
最新Version:【Version:1.2.2】
更新内容:
1.2.2.1、优化部分宏定义
最新更新时间:2017-05-20 【倒叙】
最新Version:【Version:1.1.9】
更新内容:
1.1.9.1、修复动画过度白屏问题
最新更新时间:2017-05-15 【倒叙】
最新Version:【Version:1.1.8】
更新内容:
1.1.8.1、精简代码结构,删除多余或者重复代码
1.1.8.2、规范代码属性和方法命名,原有方法名和属性名有较大改动,忘见谅
1.1.8.3、重构 actionSheet,新增多种样式
最新更新时间:2017-05-13 【倒叙】
最新Version:【Version:1.1.7】
更新内容:
1.1.7.1、精简代码结构,删除多余或者重复代码
1.1.7.2、规范代码属性和方法命名,原有方法名和属性名有较大改动,忘见谅
1.1.7.3、优化部分动画
1.1.7.4、subView 布局优化
1.1.7.5、actionSheet 新增自定义文字颜色、title 字体颜色
最新更新时间:2017-05-10 【倒叙】
最新Version:【Version:1.1.5】
更新内容:
1.1.5.1、删除原有封装内部按钮点击事件中 ba_dismissAlertView 方法,此方法可在外部自由调用
最新更新时间:2017-05-09 【倒叙】
最新Version:【Version:1.1.4】
更新内容:
1.1.4.1、pod 更新xib 文件
最新更新时间:2017-05-08 【倒叙】
最新Version:【Version:1.1.0】
更新内容:
1.1.0.1、优化方法名命名规范
1.1.0.2、新增键盘内部处理
1.1.0.3、用原生 autoLayout 重构,自定义 alert 的布局再也不是问题了
1.1.0.4、优化代码结构,修复内在隐藏内存泄漏
1.1.0.5、新增 BAAlert_OC.h 文件,只需导入 BAAlert_OC.h 一个文件就可以使用 alert 和 actionSheet 了
1.1.0.6、删除了部分代码和属性,具体见源码 和 demo
6、bug 反馈
1、开发中遇到 bug,希望小伙伴儿们能够及时反馈与我们 BAHome 团队,我们必定会认真对待每一个问题!
2、以后提需求和 bug 的同学,记得把 git 或者博客链接给我们,我直接超链到你们那里!希望大家积极参与测试!
7、BAHome 团队成员
1、QQ 群
479663605
【注意:此群为 2 元 付费群,介意的小伙伴儿勿扰!】
孙博岩
QQ:137361770
git:https://github.com/boai
简书:http://www.jianshu.com/u/95c9800fdf47
微博:
马景丽
QQ:1253540493
git:https://github.com/MaJingli
陆晓峰
QQ:442171865
git:https://github.com/zeR0Lu
陈集
QQ:3161182978
git:https://github.com/chenjipdc
简书:http://www.jianshu.com/u/90ae559fc21d
任子丰
QQ:459643690
git:https://github.com/renzifeng
吴丰收
QQ:498121294
石少庸
QQ:363605775
git:https://github.com/CrazyCoderShi
简书:http://www.jianshu.com/u/0726f4d689a3
8、开发环境 和 支持版本
开发使用 最新版本 Xcode,理论上支持 iOS 8 及以上版本,如有版本适配问题,请及时反馈!多谢合作!
9、感谢
感谢 BAHome 团队成员倾力合作,后期会推出一系列 常用 UI 控件的封装,大家有需求得也可以在 issue 提出,如果合理,我们会尽快推出新版本!
BAHome 的发展离不开小伙伴儿的信任与推广,再次感谢各位小伙伴儿的支持!
BAAlert BAAlert_OC.hBAAlert.hBAActionSheet.hdemo 示例 官网
https://github.com/BAHome/BAAlert
BlockAlertsAnd-ActionSheets
BlockAlertsAnd-ActionSheets 介绍
BlockAlertsAnd-ActionSheets - Beautifully done UIAlertView and UIActionSheet
replacements inspired by TweetBot
BlockAlertsAnd-ActionSheets 官网
https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets
Cocoa:在NSApp beginSheet结果隐藏主窗口后显示错误
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { TestingWindowController * testingWindowController = [[TestingWindowController alloc] initWithWindowNibName: @"TestingWindowController"]; // Begin our sheet [NSApp beginSheet: testingWindowController.window modalForWindow: self.window modalDelegate: self didEndSelector: @selector(windowDidEnd:returnCode:contextInfo:) contextInfo: NULL]; } - (void)windowDidEnd:(id)alert returnCode:(NSInteger)returnCode contextInfo:(id) contextInfo { // If the user did not accept,then we really don't care what else they did! if (returnCode != NSOKButton) return; // We have had an error. display it. [[NSApplication sharedApplication] presentError: nil modalForWindow: self.window delegate: nil didPresentSelector: nil contextInfo: NULL]; }
以下操作绑定到Windows笔尖上的按钮. (请注意,nib的窗口也设置为在启动时不可见).
- (IBAction) onClose: (id) sender { [[NSApplication sharedApplication] endSheet: self.window returnCode: NSOKButton]; [self.window orderOut: nil]; } // End of onClose
最终发生的事情是,一旦我onClose运行,所有的窗口都会消失,除了错误对话框(主窗口已经消失)之外我什么都没有.
我的代码有问题吗?为什么我的主窗口会消失?
注意:我知道我没有将错误传递给presentError方法.我特意留下这个null,因为我只有很短的时间来编写示例代码.传递实际错误会导致相同的行为.
示例项目可用于here.
解决方法
(取消选择UserLoginWindowController窗口在启动时始终可见)
- (IBAction)userButtonpressed:(id)sender { UserLoginWindowController * wc = [UserLoginWindowController new]; // we keep a reference,so the WC doesn't deallocate self.modalWindowController = wc; [[self window] beginSheet:[wc window] completionHandler:^(NSModalResponse returnCode) { self.modalWindowController = nil; }]; }
在UserLoginWindowController中
- (IBAction)cancelButtonpressed:(id)sender { [[[self window] sheetParent] endSheet:[self window] returnCode:NSModalResponseCancel]; }
今天关于可可 – 等待[NSAlert beginSheetModalForWindow:…];和可可的等待的分享就到这里,希望大家有所收获,若想了解更多关于A modular InnoSetup script to download and install all available .NET Framework versions and much mo、BAAlert BAAlert_OC.hBAAlert.hBAActionSheet.hdemo 示例 iOS alert 和 actionSheet 的封装、BlockAlertsAnd-ActionSheets、Cocoa:在NSApp beginSheet结果隐藏主窗口后显示错误等相关知识,可以在本站进行查询。
本文标签: