删除设置

Remove settings

我正在制作一个 iOS 应用程序,我想在您点击底部栏时删除“设置”选项(因此只会保留关闭和退出)。有什么办法可以做到这一点吗?

提前致谢!

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

中进行
  1. 您需要从操作中删除 "settings" 选项 sheet

之前:

- (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. 更改所选按钮的操作处理程序(反映新的菜单结构)。

之前:

- (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;
}