【发布时间】:2012-07-12 03:07:55
【问题描述】:
第一个视图控制器
我正在使用 UIStoryBoard 来允许 FirstViewController 将第二个 ViewController 的视图添加为子视图。在删除子视图时
- (IBAction) btnMoveTo:(id)sender
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"Second"];
vc.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:vc animated:NO];
}
SecondViewController.m
-(void)viewDidLoad{
self.view.opaque = YES;
self.view.backgroundColor = [UIColor clearColor];
}
- (IBAction) withDraw:(id)sender{
[self.view removeWithZoomOutAnimation:2 option:nil];
}
当我访问 withDraw 函数时,SecondViewController 的视图被移除并且 firstViewController 又回来了。但是,当我使用按钮访问 - (IBAction) btnMoveTo:(id)sender 函数时。它不起作用。什么都没有发生。任何建议或帮助将不胜感激。
【问题讨论】:
-
据我所知,你的问题可能来自 StoryBoard 文件 (90%),检查那里的名称,并确保
secondViewController里面确实有东西(你甚至无法判断它在视图为空且以 clearColor 作为 BG 的情况下工作)。还要确保您正确链接了您的 IBOutlets。
标签: ios xcode uiviewcontroller ibaction