From 6a941f95dd2ebecdf246820ed90bd63ec8009a45 Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Fri, 2 Apr 2021 16:17:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0navigationController=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/ios/Runner.xcodeproj/project.pbxproj | 6 +++ example/ios/Runner/Base.lproj/Main.storyboard | 9 +++-- .../ios/Runner/FNBaseFlutterViewController.h | 18 +++++++++ .../ios/Runner/FNBaseFlutterViewController.m | 38 +++++++++++++++++++ 4 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 example/ios/Runner/FNBaseFlutterViewController.h create mode 100644 example/ios/Runner/FNBaseFlutterViewController.m diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 71000f8..05769ae 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 0AE1282E2855C01A7663C354 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A860D105A09AEA74261219D2 /* libPods-Runner.a */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1F2F55D7256DFF5400A97630 /* app_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 1F2F55D6256DFF5400A97630 /* app_icon.png */; }; + 1F5407E52616FE4800C6A831 /* FNBaseFlutterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F5407E42616FE4800C6A831 /* FNBaseFlutterViewController.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -41,6 +42,8 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 1F2F55D6256DFF5400A97630 /* app_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = app_icon.png; sourceTree = ""; }; + 1F5407E32616FE4800C6A831 /* FNBaseFlutterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FNBaseFlutterViewController.h; sourceTree = ""; }; + 1F5407E42616FE4800C6A831 /* FNBaseFlutterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FNBaseFlutterViewController.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3CF5E07C1CDF5F802B057127 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 5F28AF46041AA2464EF2701A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; @@ -123,6 +126,8 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 1F5407E32616FE4800C6A831 /* FNBaseFlutterViewController.h */, + 1F5407E42616FE4800C6A831 /* FNBaseFlutterViewController.m */, 9F5F7EA525626514009BD779 /* Runner.entitlements */, 9FFCE2F3251ADE0600F4F353 /* 项目资源 */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, @@ -362,6 +367,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 1F5407E52616FE4800C6A831 /* FNBaseFlutterViewController.m in Sources */, 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/example/ios/Runner/Base.lproj/Main.storyboard index 6f73d39..df4b87d 100644 --- a/example/ios/Runner/Base.lproj/Main.storyboard +++ b/example/ios/Runner/Base.lproj/Main.storyboard @@ -1,16 +1,16 @@ - + - + - + - + @@ -20,6 +20,7 @@ + diff --git a/example/ios/Runner/FNBaseFlutterViewController.h b/example/ios/Runner/FNBaseFlutterViewController.h new file mode 100644 index 0000000..668484a --- /dev/null +++ b/example/ios/Runner/FNBaseFlutterViewController.h @@ -0,0 +1,18 @@ +// +// FNBaseFlutterViewController.h +// Runner +// +// Created by FNUser on 2020/10/28. +// + +#import +#import "Flutter/FlutterViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FNBaseFlutterViewController : FlutterViewController + + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/Runner/FNBaseFlutterViewController.m b/example/ios/Runner/FNBaseFlutterViewController.m new file mode 100644 index 0000000..bdc8bcc --- /dev/null +++ b/example/ios/Runner/FNBaseFlutterViewController.m @@ -0,0 +1,38 @@ +// +// FNBaseFlutterViewController.m +// Runner +// +// Created by FNUser on 2020/10/28. +// + +#import "FNBaseFlutterViewController.h" + +@interface FNBaseFlutterViewController () + + +@end + +@implementation FNBaseFlutterViewController + + +- (void)viewDidLoad { + [super viewDidLoad]; + UIWindow *window = [UIApplication sharedApplication].delegate.window; + UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self]; + window.rootViewController = navController; + navController.navigationBar.hidden = YES; + +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:animated]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:YES animated:animated]; +} + + +@end