(iOS) Remove the Settings button on the top bar if a settings view controller is present in the backstack (prevents recursive opening of settings menu)
This commit is contained in:
parent
542a6b0385
commit
d67fc02b26
|
@ -208,6 +208,7 @@ static void event_reload_config(void* userdata)
|
|||
bool _isGameTop;
|
||||
bool _isPaused;
|
||||
bool _isRunning;
|
||||
uint32_t _settingMenusInBackStack;
|
||||
|
||||
RAModuleInfo* _module;
|
||||
}
|
||||
|
@ -268,11 +269,17 @@ static void event_reload_config(void* userdata)
|
|||
// UINavigationController: Never animate when pushing onto, or popping, an RAGameView
|
||||
- (void)pushViewController:(UIViewController*)theView animated:(BOOL)animated
|
||||
{
|
||||
if ([theView respondsToSelector:@selector(isSettingsView)] && [(id)theView isSettingsView])
|
||||
_settingMenusInBackStack ++;
|
||||
|
||||
[super pushViewController:theView animated:animated && !_isGameTop];
|
||||
}
|
||||
|
||||
- (UIViewController*)popViewControllerAnimated:(BOOL)animated
|
||||
{
|
||||
if ([self.topViewController respondsToSelector:@selector(isSettingsView)] && [(id)self.topViewController isSettingsView])
|
||||
_settingMenusInBackStack --;
|
||||
|
||||
return [super popViewControllerAnimated:animated && !_isGameTop];
|
||||
}
|
||||
|
||||
|
@ -363,11 +370,15 @@ static void event_reload_config(void* userdata)
|
|||
#pragma mark PAUSE MENU
|
||||
- (UIBarButtonItem*)createSettingsButton
|
||||
{
|
||||
return [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Settings"
|
||||
style:UIBarButtonItemStyleBordered
|
||||
target:[RetroArch_iOS get]
|
||||
action:@selector(showSystemSettings)];
|
||||
if (_settingMenusInBackStack == 0)
|
||||
return [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Settings"
|
||||
style:UIBarButtonItemStyleBordered
|
||||
target:[RetroArch_iOS get]
|
||||
action:@selector(showSystemSettings)];
|
||||
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (IBAction)showPauseMenu:(id)sender
|
||||
|
|
|
@ -50,6 +50,8 @@ enum SettingTypes
|
|||
- (id)initWithSettings:(NSArray*)values title:(NSString*)title;
|
||||
- (void)handleCustomAction:(NSString*)action withUserData:(id)data;
|
||||
- (void)writeSettings:(NSArray*)settingList toConfig:(config_file_t*)config;
|
||||
|
||||
- (bool)isSettingsView;
|
||||
@end
|
||||
|
||||
@interface RASettingsList : RASettingsSubList
|
||||
|
|
|
@ -348,6 +348,11 @@ static RASettingData* custom_action(NSString* action, id data)
|
|||
return self;
|
||||
}
|
||||
|
||||
- (bool)isSettingsView
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
- (void)handleCustomAction:(NSString*)action withUserData:(id)data
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue