我正在制作iOS应用,我想在点击底栏时删除“设置”选项(因此只关闭并退出)。有没有办法做到这一点,怎么样?
提前致谢!
答案 0 :(得分:1)
所有必需的更改都将在SKTNavigationManager.m中进行:
在:
- (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];
}
在:
- (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;
}