1. 程式人生 > >iOS 連續多次present 之後,想回到最初的viewController

iOS 連續多次present 之後,想回到最初的viewController

// The view controller that was presented by this view controller or its nearest ancestor.

此檢視控制器的檢視控制器或其最近的祖先。

@property(nullable, nonatomic,readonly) UIViewController *presentedViewController  NS_AVAILABLE_IOS(5_0);

// The view controller that presented this view controller (or its farthest ancestor.)

提出了這個檢視控制器的檢視控制器(或其最遠的祖先)。

@property(nullable, nonatomic,readonly) UIViewController *presentingViewController NS_AVAILABLE_IOS(5_0);

  [self.presentingViewController.presentingViewControllerdismissViewControllerAnimated:YEScompletion:nil];

這句話的意思是找到最遠的祖先,dismiss掉。

    iOS控制器堆疊是,最疊層的。最初始的畫面dismiss掉,子畫面也dismiss。