UITableViewを閉じる方法は?
-
05-07-2019 - |
質問
ユーザーが設定ボタンをクリックすると、私のアプリはuitableview画面を表示します。アクションで却下する要求をどのように結び付けるかわかりません。
uitableview内からこのビューを閉じるにはどうすればよいですか?
ビューの設定:
SettingsController *rootViewController = [[SettingsController alloc]
initWithStyle:UITableViewStyleGrouped];
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:rootViewController];
settingsView = navigationController.view;
settingsView.frame =
CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view insertSubview:settingsView atIndex:0];
前面にビューを表示:
- (IBAction)settingsPressed:(id)sender{
[self.view bringSubviewToFront:settingsView];
}
背面にビューを配置:
- (void)QuitSettings {
[self.view sendSubviewToBack:settingsView];
}
キャッチ" return&quot ;; SettingsControllerのボタンをクリック:
- (void) action:(id) sender{
//[super.view sendSubviewToBack:holdingView];
// access error [self release];
// nothing [holdingView removeFromSuperview];
// access error [super QuitSettings];
}
解決
特定のインデックスにサブビューを挿入するのではなく、モーダルビューを使用したいようです。
使用する必要があります
[self presentModalViewController:myTableViewController animated:YES];
selfは、Table Viewを呼び出すための呼び出しを行うView Controllerです。
次に、Table View Controllerのどこかに呼び出すボタンまたはアクションを添付できます
[self.parentViewController dismissModalViewControllerAnimated:YES];
Table View Controllerを閉じます。
他のヒント
これは機能しませんか?
[settingsView removeFromSuperView]
所属していません StackOverflow