删除设置

时间:2016-07-11 12:35:20

标签: ios skmaps

我正在制作iOS应用,我想在点击底栏时删除“设置”选项(因此只关闭并退出)。有没有办法做到这一点,怎么样?

提前致谢!

1 个答案:

答案 0 :(得分:1)

所有必需的更改都将在SKTNavigationManager.m中进行:

  1. 您需要从操作表中删除“设置”选项
  2. 在:

    - (void)mapView:(SKMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate {
    SKTActionSheet *sheet = nil;
    if ([self currentNavigationState] == SKTNavigationStateCalculatingRoute) {
        sheet = [SKTActionSheet actionSheetWithButtonTitles:@[NSLocalizedString(kSKTQuitKey, nil)] cancelButtonTitle:NSLocalizedString(kSKTCancelKey, nil)];
    } else {
        sheet = [SKTActionSheet actionSheetWithButtonTitles:@[NSLocalizedString(kSKTSettingsKey, nil), NSLocalizedString(kSKTQuitKey, nil)] cancelButtonTitle:NSLocalizedString(kSKTCancelKey, nil)];
    }
    
    sheet.delegate = self;
    _activeActionSheet = sheet;
    [sheet showInView:_mainView];
    }
    

    后:

    - (void)mapView:(SKMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate {
    SKTActionSheet *sheet = nil;
    if ([self currentNavigationState] == SKTNavigationStateCalculatingRoute) {
        sheet = [SKTActionSheet actionSheetWithButtonTitles:@[NSLocalizedString(kSKTQuitKey, nil)] cancelButtonTitle:NSLocalizedString(kSKTCancelKey, nil)];
    } else {
        sheet = [SKTActionSheet actionSheetWithButtonTitles:@[ NSLocalizedString(kSKTQuitKey, nil)] cancelButtonTitle:NSLocalizedString(kSKTCancelKey, nil)];
    }
    
    sheet.delegate = self;
    _activeActionSheet = sheet;
    [sheet showInView:_mainView];
    }
    
    1. 更改所选按钮的操作处理程序(反映新的菜单结构)。
    2. 在:

      - (void)actionSheet:(SKTActionSheet *)actionSheet didSelectButtonAtIndex:(NSUInteger)index {
      if (index == 0) {
          if ([self currentNavigationState] == SKTNavigationStateCalculatingRoute) {
              [self stopNavigationWithReason:SKTNavigationStopReasonUserQuit stopAudio:YES];
          } else {
              //remove states that should't exist while settings view is visible
              [self removeState:SKTNavigationStateBlockRoads];
              [self removeState:SKTNavigationStateOverview];
              [self removeState:SKTNavigationStateRouteInfo];
      
              [self pushNavigationStateIfNotPresent:SKTNavigationStateSettings];
          }
      
          [actionSheet dismissInstantly];
          self.mainView.settingsView.delegate = self;
      } else if (index == 1) {
          if (self.isFreeDrive) {
              [self stopNavigationWithReason:SKTNavigationStopReasonUserQuit stopAudio:YES];
          } else {
              [self confirmStopNavigation];
          }
      
          [actionSheet dismiss];
      }
      
      _activeActionSheet = nil;
      }
      

      后:

      (void)actionSheet:(SKTActionSheet *)actionSheet didSelectButtonAtIndex:(NSUInteger)index {
      if (index == 0) {
          if (self.isFreeDrive) {
              [self stopNavigationWithReason:SKTNavigationStopReasonUserQuit stopAudio:YES];
          } else {
              [self confirmStopNavigation];
          }
      
          [actionSheet dismiss];
      }
      
      _activeActionSheet = nil;
      }