UIWindow(FWNavigation)
@interface UIWindow (FWNavigation)
/// 获取最顶部的视图控制器
@property (nonatomic, readonly, nullable) UIViewController *fw_topViewController NS_REFINED_FOR_SWIFT;
/// 获取最顶部的导航栏控制器。如果顶部VC不含导航栏,返回nil
@property (nonatomic, readonly, nullable) UINavigationController *fw_topNavigationController NS_REFINED_FOR_SWIFT;
/// 获取最顶部的显示控制器
@property (nonatomic, readonly, nullable) UIViewController *fw_topPresentedController NS_REFINED_FOR_SWIFT;
/// 使用最顶部的导航栏控制器打开控制器
- (BOOL)fw_pushViewController:(UIViewController *)viewController animated:(BOOL)animated NS_REFINED_FOR_SWIFT;
/// 使用最顶部的导航栏控制器打开控制器,同时pop指定数量控制器
- (BOOL)fw_pushViewController:(UIViewController *)viewController pop:(NSUInteger)count animated:(BOOL)animated NS_REFINED_FOR_SWIFT;
/// 使用最顶部的显示控制器弹出控制器,建议present导航栏控制器(可用来push)
- (void)fw_presentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;
/// 使用最顶部的视图控制器打开控制器,自动判断push|present,完成时回调
- (void)fw_openViewController:(UIViewController *)viewController animated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;
/// 关闭最顶部的视图控制器,自动判断pop|dismiss,返回是否成功,完成时回调
- (BOOL)fw_closeViewControllerAnimated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;
/// 获取当前主window
@property (class, nonatomic, readonly, nullable) UIWindow *fw_mainWindow NS_REFINED_FOR_SWIFT;
/// 获取当前主场景
@property (class, nonatomic, readonly, nullable) UIWindowScene *fw_mainScene API_AVAILABLE(ios(13.0)) NS_REFINED_FOR_SWIFT;
/// 获取最顶部的视图控制器
@property (class, nonatomic, readonly, nullable) UIViewController *fw_topViewController NS_REFINED_FOR_SWIFT;
/// 获取最顶部的导航栏控制器。如果顶部VC不含导航栏,返回nil
@property (class, nonatomic, readonly, nullable) UINavigationController *fw_topNavigationController NS_REFINED_FOR_SWIFT;
/// 获取最顶部的显示控制器
@property (class, nonatomic, readonly, nullable) UIViewController *fw_topPresentedController NS_REFINED_FOR_SWIFT;
/// 使用最顶部的导航栏控制器打开控制器
+ (BOOL)fw_pushViewController:(UIViewController *)viewController animated:(BOOL)animated NS_REFINED_FOR_SWIFT;
/// 使用最顶部的导航栏控制器打开控制器,同时pop指定数量控制器
+ (BOOL)fw_pushViewController:(UIViewController *)viewController pop:(NSUInteger)count animated:(BOOL)animated NS_REFINED_FOR_SWIFT;
/// 使用最顶部的显示控制器弹出控制器,建议present导航栏控制器(可用来push)
+ (void)fw_presentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;
/// 使用最顶部的视图控制器打开控制器,自动判断push|present,完成时回调
+ (void)fw_openViewController:(UIViewController *)viewController animated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;
/// 关闭最顶部的视图控制器,自动判断pop|dismiss,返回是否成功,完成时回调
+ (BOOL)fw_closeViewControllerAnimated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion NS_REFINED_FOR_SWIFT;
@end
Undocumented
-
获取最顶部的视图控制器
Declaration
Objective-C
@property (nonatomic, readonly, nullable) UIViewController *fw_topViewController;
-
获取最顶部的导航栏控制器。如果顶部VC不含导航栏,返回nil
Declaration
Objective-C
@property (nonatomic, readonly, nullable) UINavigationController *fw_topNavigationController;
-
获取最顶部的显示控制器
Declaration
Objective-C
@property (nonatomic, readonly, nullable) UIViewController *fw_topPresentedController;
-
使用最顶部的导航栏控制器打开控制器
Declaration
Objective-C
- (BOOL)fw_pushViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated;
-
使用最顶部的导航栏控制器打开控制器,同时pop指定数量控制器
Declaration
Objective-C
- (BOOL)fw_pushViewController:(nonnull UIViewController *)viewController pop:(NSUInteger)count animated:(BOOL)animated;
-
使用最顶部的显示控制器弹出控制器,建议present导航栏控制器(可用来push)
Declaration
Objective-C
- (void)fw_presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated completion:(nullable void (^)(void))completion;
-
使用最顶部的视图控制器打开控制器,自动判断push|present,完成时回调
Declaration
Objective-C
- (void)fw_openViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion;
-
关闭最顶部的视图控制器,自动判断pop|dismiss,返回是否成功,完成时回调
Declaration
Objective-C
- (BOOL)fw_closeViewControllerAnimated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion;
-
获取当前主window
Declaration
Objective-C
@property (class, nonatomic, readonly, nullable) UIWindow *fw_mainWindow;
-
获取当前主场景
Declaration
Objective-C
@property (class, nonatomic, readonly, nullable) UIWindowScene *fw_mainScene;
-
获取最顶部的视图控制器
Declaration
Objective-C
@property (class, nonatomic, readonly, nullable) UIViewController *fw_topViewController;
-
获取最顶部的导航栏控制器。如果顶部VC不含导航栏,返回nil
Declaration
Objective-C
@property (class, nonatomic, readonly, nullable) UINavigationController *fw_topNavigationController;
-
获取最顶部的显示控制器
Declaration
Objective-C
@property (class, nonatomic, readonly, nullable) UIViewController *fw_topPresentedController;
-
使用最顶部的导航栏控制器打开控制器
Declaration
Objective-C
+ (BOOL)fw_pushViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated;
-
使用最顶部的导航栏控制器打开控制器,同时pop指定数量控制器
Declaration
Objective-C
+ (BOOL)fw_pushViewController:(nonnull UIViewController *)viewController pop:(NSUInteger)count animated:(BOOL)animated;
-
使用最顶部的显示控制器弹出控制器,建议present导航栏控制器(可用来push)
Declaration
Objective-C
+ (void)fw_presentViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated completion:(nullable void (^)(void))completion;
-
使用最顶部的视图控制器打开控制器,自动判断push|present,完成时回调
Declaration
Objective-C
+ (void)fw_openViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion;
-
关闭最顶部的视图控制器,自动判断pop|dismiss,返回是否成功,完成时回调
Declaration
Objective-C
+ (BOOL)fw_closeViewControllerAnimated:(BOOL)animated options:(FWNavigationOptions)options completion:(nullable void (^)(void))completion;