-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
76 additions
and
20 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface GBLibraryViewController : UITabBarController | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#import "GBLibraryViewController.h" | ||
#import "GBLoadROMTableViewController.h" | ||
#import "GBHubViewController.h" | ||
#import "GBViewController.h" | ||
|
||
@implementation GBLibraryViewController | ||
|
||
+ (UIViewController *)wrapViewController:(UIViewController *)controller | ||
{ | ||
UINavigationController *ret = [[UINavigationController alloc] initWithRootViewController:controller]; | ||
UIBarButtonItem *close = [[UIBarButtonItem alloc] initWithTitle:@"Close" | ||
style:UIBarButtonItemStylePlain | ||
target:[UIApplication sharedApplication].delegate | ||
action:@selector(dismissViewController)]; | ||
[ret.visibleViewController.navigationItem setLeftBarButtonItem:close]; | ||
return ret; | ||
} | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
self.viewControllers = @[ | ||
[self.class wrapViewController:[[GBLoadROMTableViewController alloc] init]], | ||
[self.class wrapViewController:[[GBHubViewController alloc] init]], | ||
]; | ||
if (@available(iOS 13.0, *)) { | ||
UIEdgeInsets insets = [UIApplication sharedApplication].keyWindow.safeAreaInsets; | ||
bool hasHomeButton = insets.bottom == 0; | ||
bool isPad = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad; | ||
NSString *symbol = isPad? @"ipad" : @"iphone"; | ||
if (hasHomeButton) { | ||
symbol = [symbol stringByAppendingString:@".homebutton"]; | ||
} | ||
else if (!isPad) { | ||
if (@available(iOS 16.1, *)) { | ||
if (MAX(insets.left, MAX(insets.right, MAX(insets.top, insets.bottom))) > 51) { | ||
symbol = @"iphone.gen3"; | ||
} | ||
else { | ||
symbol = @"iphone.gen2"; | ||
} | ||
} | ||
} | ||
self.viewControllers[0].tabBarItem.image = [UIImage systemImageNamed:symbol] ?: [UIImage systemImageNamed:@"folder.fill"]; | ||
self.viewControllers[1].tabBarItem.image = [UIImage systemImageNamed:@"globe"]; | ||
} | ||
else { | ||
self.viewControllers[0].tabBarItem.image = [UIImage imageNamed:@"FolderTemplate"]; | ||
self.viewControllers[1].tabBarItem.image = [UIImage imageNamed:@"GlobeTemplate"]; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.