解雇后查看一个子视图有不同的地方

时间:2022-12-05 14:59:51

Hello I have a problem with un/showing a TableViewController.

你好我有/显示TableViewController的问题。

I have a Scrollview with 4Subviews (the last subView is optionally, if a Button is clicked or not). In this optionally subview is a Button. If the button is clicked a new View with a TableView will open. If i click a cell in this TableView i want to go back to the last View.

我有一个带有4个子视图的Scrollview(如果点击了一个按钮,最后一个子视图是可选的)。在这个可选的子视图中是一个Button。如果单击该按钮,将打开带有TableView的新视图。如果我单击此TableView中的单元格,我想返回上一个视图。

Everything works fine, but the optionally View is shown always in the middle of the Screen instead of the last View on the ScrollView.

一切正常,但可选的View始终显示在屏幕的中间而不是ScrollView上的最后一个View。

function to show the TableView:

函数显示TableView:

- (void)CategoryButtonClicked:(id)sender {
[self presentViewController:advancedSearchTableViewController animated:YES completion:nil];
advancedSearchTableViewController.SourceView = @"Category";}

function to dismiss the Table View:

函数解除表视图:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

[self dismissViewControllerAnimated:YES completion:nil];}

1 个解决方案

#1


0  

Use the Container View pattern and add your tableViewController as a child view controller. Here is a good reference: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html

使用Container View模式并将tableViewController添加为子视图控制器。这是一个很好的参考:https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html

#1


0  

Use the Container View pattern and add your tableViewController as a child view controller. Here is a good reference: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html

使用Container View模式并将tableViewController添加为子视图控制器。这是一个很好的参考:https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html