2011-02-10 45 views
8

Tôi có bộ điều khiển điều hướng hiển thị một chế độ xem điều khiển phương thức. Từ bên trong khung nhìn phương thức này, tôi trình bày một phương thức viewController khác. Tất cả những gì tôi muốn là lấy lại từ viewController phương thức cuối cùng đến navigationController (root viewController) .Một cái gì đó tương tự với popToRootViewController, nhưng thích nghi với modalViewControllers;Loại bỏ hai bộ điều khiển chế độ xem

NavigationController -> hiện phương thức ViewController A -> hiện phương thức ViewController B

Từ modal ViewController B Tôi muốn trở lại navigationCOntroller.

Điều này có khả thi không?

Đánh giá cao, Alex.

+0

More cách chung chung để sa thải hơn là một bộ điều khiển xem phương thức là [ở đây] (https://stackoverflow.com/a/44583711/1151916) – Ramis

Trả lời

5

Vấn đề giải quyết :)

tôi đã cố gắng

[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];  

và các công trình.

Cảm ơn.

+0

@ user285553: Tốt .. – EmptyStack

+0

Sử dụng 'presentingViewController' trong iOS 5 –

30

Trong iOS 5 bạn cần làm

[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES]

Chỉnh sửa: Tính đến iOS 6 dismissModalViewControllerAnimated: bị phản đối.

Bạn cần phải gọi

[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{ // Do something on completion}]

Các vấn đề liên quan