如何在 iPad 中从子视图更新超级视图?
我有一个 UISegmentedController,我有 3 个 UIViewController,比如照片、相框、画廊。 我使用“addSubView”在 Superview 中添加这 3 个视图。在框架视图中,我添加了一个名为 EditView 的子视图。在 EditView 中我做了一些更改,我想在框架视图中更新这些更改。但是,当我从框架视图中删除 EditView 时,任何单个方法都不会调用。那么如何在超级视图中更新子视图的更改。树:UISegmentedController ->框架(Su) ->编辑视图(子视图)。任何人都可以帮助我吗..
I have a UISegmentedController i have 3 UIViewControllers Like photos,frames,gallery.
I add those 3 Views in Superview Using 'addSubView'. In frames view i have added a subview that name as EditView. In EditView i have done some changes, i want to update these changes in frames view. But when am removing EditView from frames view any single method doesn't calling. Then how to update the changes from subview in superview. Tree: UISegmentedController -> Frames(Su) -> EditViews(Subview). Can any one help me..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找到了从子视图更新超级视图中某些内容的代码。请在您的子视图中使用此代码。它将调用您的超级视图 viewWillAppear 方法。您可以使用其他方法来代替 viewWillAppear。这对我有用。
-Yuva.M
I found the code to update something in superview from subview. Please use this code in your subview. It will call your superview viewWillAppear method. You can use another method instead of viewWillAppear. It works for me.
-Yuva.M
您可以使用
UIView
的superview
属性访问任何UIView
的超级视图。以下语句将位于您的
EditView
中。下一条语句可能是调用超级视图函数。
updateMySuperView 是您的
superview
的一部分。You could access the super view of any
UIView
by using thesuperview
property ofUIView
.The below statement will be in your
EditView
.and the next statement could be calling the super view function.
updateMySuperView is the part of your
superview
.从其超级视图中删除视图会释放它。
在从其超级视图中删除 editView 之前提交更改。您可以在 editView 中覆盖
removeFromSuperview
,并在调用super removeFromSuperview
之前进行数据操作。或者您的视图控制器可以在删除 editView 之前获取数据。
Removing a view from its superview releases it.
Submit your changes before removing the editView from its superview. You could overwrite
removeFromSuperview
in your editView, and do your data manipulation before callingsuper removeFromSuperview
.Or your view controller could take data from the editView before removing it.