【发布时间】:2012-12-31 23:02:42
【问题描述】:
我有两个视图控制器,分别命名为 firstvc、secondvc。我在firstvc 中有一个子视图,它看起来像一个包含文本字段的表单。在firstvc 中有一个按钮可以最大化该子视图。
当我点击它时,我将该子视图添加到 secondvc 并在 UAModalPanel 中呈现 secondvc 视图。如果我关闭那个secondvc,firstvc 应该会出现。我的问题是我无法保留该子视图。这意味着当我关闭secondvc 时,firstvc 子视图正在消失。
您能否建议如何在两个视图控制器之间保留该子视图?
-(IBAction)maximize:(id)sender
{
UIViewController *newview = [self.storyboard instantiateViewControllerWithIdentifier:@"second"];
[newview.view addSubview:subview];
UAModalPanel *modalpanelobject = [[UAModalPanel alloc]initWithFrame:self.view.bounds];
[modalpanelobject.contentView addSubview:newview.view];
[self.view addSubview:modalpanelobject];
[modalpanelobject showFromPoint:self.view.center];
}
【问题讨论】:
-
您能否发布您用于显示/关闭
secondvc的代码以及将子视图添加到firstvc的方式? -
嘿,我添加了最大化代码,用于关闭模式面板视图,它会自动提供关闭按钮。
标签: iphone ios objective-c ipad view