ios: Some view management cleanup
This commit is contained in:
parent
1fbe66cad0
commit
a4dd4e4463
|
@ -7,8 +7,8 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
extern NSString *const GSEventKeyDownNotification;
|
||||
extern NSString *const GSEventKeyUpNotification;
|
||||
extern NSString* const GSEventKeyDownNotification;
|
||||
extern NSString* const GSEventKeyUpNotification;
|
||||
|
||||
@interface RetroArch_iOS : UIResponder <UIApplicationDelegate>
|
||||
|
||||
|
@ -16,12 +16,13 @@ extern NSString *const GSEventKeyUpNotification;
|
|||
- (void)runGame:(NSString*)path;
|
||||
- (void)gameHasExited;
|
||||
|
||||
- (void)pushViewController:(UIViewController*)theView;
|
||||
- (void)popViewController;
|
||||
|
||||
@property (strong, nonatomic) NSString* system_directory;
|
||||
@property (strong, nonatomic) NSString* config_file_path;
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
@property (strong, nonatomic) NSString *module_path;
|
||||
@property (strong, nonatomic) UINavigationController *navigator;
|
||||
@property (strong, nonatomic) NSString* module_path;
|
||||
@property (strong, nonatomic) UIImage* file_icon;
|
||||
@property (strong, nonatomic) UIImage* folder_icon;
|
||||
@property (strong, nonatomic) UIBarButtonItem* settings_button;
|
||||
|
|
|
@ -23,6 +23,9 @@ extern uint32_t ios_current_touch_count;
|
|||
@implementation RetroArch_iOS
|
||||
{
|
||||
game_view* game;
|
||||
|
||||
UIWindow* window;
|
||||
UINavigationController* navigator;
|
||||
}
|
||||
|
||||
+ (RetroArch_iOS*)get
|
||||
|
@ -33,18 +36,34 @@ extern uint32_t ios_current_touch_count;
|
|||
- (void)runGame:(NSString*)path
|
||||
{
|
||||
game = [[game_view alloc] initWithGame:path];
|
||||
self.window.rootViewController = game;
|
||||
self.navigator = nil;
|
||||
window.rootViewController = game;
|
||||
navigator = nil;
|
||||
}
|
||||
|
||||
- (void)gameHasExited
|
||||
{
|
||||
game = nil;
|
||||
|
||||
self.navigator = [[UINavigationController alloc] init];
|
||||
[self.navigator pushViewController: [[module_list alloc] init] animated:YES];
|
||||
navigator = [[UINavigationController alloc] init];
|
||||
[navigator pushViewController: [[module_list alloc] init] animated:YES];
|
||||
|
||||
self.window.rootViewController = self.navigator;
|
||||
window.rootViewController = navigator;
|
||||
}
|
||||
|
||||
- (void)pushViewController:(UIViewController*)theView
|
||||
{
|
||||
if (navigator != nil)
|
||||
{
|
||||
[navigator pushViewController:theView animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)popViewController
|
||||
{
|
||||
if (navigator != nil)
|
||||
{
|
||||
[navigator popViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
|
@ -68,12 +87,12 @@ extern uint32_t ios_current_touch_count;
|
|||
self.settings_button.action = @selector(show_settings);
|
||||
|
||||
// Setup window
|
||||
self.navigator = [[UINavigationController alloc] init];
|
||||
[self.navigator pushViewController: [[module_list alloc] init] animated:YES];
|
||||
navigator = [[UINavigationController alloc] init];
|
||||
[navigator pushViewController: [[module_list alloc] init] animated:YES];
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
self.window.rootViewController = self.navigator;
|
||||
[self.window makeKeyAndVisible];
|
||||
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
window.rootViewController = navigator;
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
// Setup keyboard hack
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyPressed:) name: GSEventKeyDownNotification object: nil];
|
||||
|
@ -110,7 +129,7 @@ extern uint32_t ios_current_touch_count;
|
|||
|
||||
- (void)show_settings
|
||||
{
|
||||
[self.navigator pushViewController: [[SettingsList alloc] init] animated:YES];
|
||||
[self pushViewController:[SettingsList new]];
|
||||
}
|
||||
|
||||
- (void)processTouches:(NSArray*)touches
|
||||
|
|
|
@ -57,9 +57,7 @@ static BOOL is_directory(NSString* path)
|
|||
|
||||
if(is_directory(path))
|
||||
{
|
||||
[[RetroArch_iOS get].navigator
|
||||
pushViewController:[[directory_list alloc] initWithPath:path]
|
||||
animated:YES];
|
||||
[[RetroArch_iOS get] pushViewController:[[directory_list alloc] initWithPath:path]];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ static void display_error_alert(NSString* message)
|
|||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
[RetroArch_iOS get].module_path = [modules objectAtIndex:indexPath.row];
|
||||
[[RetroArch_iOS get].navigator pushViewController:[[directory_list alloc] initWithPath:nil] animated:YES];
|
||||
[[RetroArch_iOS get] pushViewController:[[directory_list alloc] initWithPath:nil]];
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
value.value = @"";
|
||||
|
||||
[view reloadData];
|
||||
[[RetroArch_iOS get].navigator popViewControllerAnimated:YES];
|
||||
[[RetroArch_iOS get] popViewController];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -66,9 +66,7 @@ static const char* const SETTINGID = "SETTING";
|
|||
{
|
||||
case EnumerationSetting:
|
||||
case FileListSetting:
|
||||
[[RetroArch_iOS get].navigator
|
||||
pushViewController:[[SettingEnumerationList alloc] initWithSetting:setting fromTable:(UITableView*)self.view]
|
||||
animated:YES];
|
||||
[[RetroArch_iOS get] pushViewController:[[SettingEnumerationList alloc] initWithSetting:setting fromTable:(UITableView*)self.view]];
|
||||
break;
|
||||
|
||||
case ButtonSetting:
|
||||
|
@ -76,9 +74,7 @@ static const char* const SETTINGID = "SETTING";
|
|||
break;
|
||||
|
||||
case GroupSetting:
|
||||
[[RetroArch_iOS get].navigator
|
||||
pushViewController:[[SettingsSubList alloc] initWithSettings:setting.subValues title:setting.label]
|
||||
animated:YES];
|
||||
[[RetroArch_iOS get] pushViewController:[[SettingsSubList alloc] initWithSettings:setting.subValues title:setting.label]];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue