diff --git a/ios/RetroArch/BTStack/WiiMoteHelper.h b/ios/RetroArch/BTStack/WiiMoteHelper.h index eef5dd6036..37a63fb567 100644 --- a/ios/RetroArch/BTStack/WiiMoteHelper.h +++ b/ios/RetroArch/BTStack/WiiMoteHelper.h @@ -35,6 +35,7 @@ @interface WiiMoteHelper : NSObject + (WiiMoteHelper*)get; ++ (BOOL)isBluetoothRunning; + (void)stopBluetooth; - (void)showDiscovery; @end diff --git a/ios/RetroArch/BTStack/WiiMoteHelper.m b/ios/RetroArch/BTStack/WiiMoteHelper.m index 1332a81762..8fd79831f6 100644 --- a/ios/RetroArch/BTStack/WiiMoteHelper.m +++ b/ios/RetroArch/BTStack/WiiMoteHelper.m @@ -61,6 +61,11 @@ static bool btOK; return instance; } ++ (BOOL)isBluetoothRunning +{ + return btOK; +} + + (void)stopBluetooth { instance = nil; diff --git a/ios/RetroArch/RetroArch_iOS.m b/ios/RetroArch/RetroArch_iOS.m index 6b5467dc84..a8da608770 100644 --- a/ios/RetroArch/RetroArch_iOS.m +++ b/ios/RetroArch/RetroArch_iOS.m @@ -63,12 +63,12 @@ - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { #ifdef WIIMOTE - UIBarButtonItem* bbi = [[UIBarButtonItem alloc] - initWithTitle:@"Stop Bluetooth" - style:UIBarButtonItemStyleBordered - target:[RetroArch_iOS get] - action:@selector(stopBluetooth)]; - navigationController.topViewController.navigationItem.rightBarButtonItem = bbi; + navigationController.topViewController.navigationItem.rightBarButtonItem = (![WiiMoteHelper isBluetoothRunning]) ? nil : + [[UIBarButtonItem alloc] + initWithTitle:@"Stop Bluetooth" + style:UIBarButtonItemStyleBordered + target:[RetroArch_iOS get] + action:@selector(stopBluetooth)]; #endif } @@ -374,6 +374,7 @@ { #ifdef WIIMOTE [WiiMoteHelper stopBluetooth]; + [_navigator.topViewController.navigationItem setRightBarButtonItem:nil animated:YES]; #endif }