【发布时间】:2011-07-11 08:59:30
【问题描述】:
我想显示一个模态视图,但不想使用标准方法,因为它们不允许我按照我的喜好为子视图设置动画。 我试过下面的代码:
EventsCalendarController *calController = [[EventsCalendarController alloc] init];
calController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:calController animated:YES];
[calController release];
但问题是我想使用一些动画来显示它,所以我使用以下代码以及 [UIView beginAnimation] 等...
EventsCalendarController *calController = [[EventsCalendarController alloc] init];
calController.modalPresentationStyle = UIModalPresentationFormSheet;
[self.view addSubview:calController.view];
[calController release];
问题是,每当我从“EventsCalendarController”调用以下代码时,都会出现异常:
- (IBAction)btnClose_TouchUpInside:(id)sender {
[self.view removeFromSuperview];
}
这里是个例外:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType btnClose_TouchUpInside:]: unrecognized selector sent to instance 0x7029d60'
我该如何解决/克服这个问题?谢谢。
更新: 已解决:我在 GitHub 上找到以下代码:https://github.com/horaceho/iphone-custom-dialogbox 这是一个完整的示例,只需编写很少的代码。没找到原作者,所以只是链接代码...
【问题讨论】:
标签: iphone ios4 uiviewcontroller modal-dialog