Skip to content

Disable selection of certain steps

Roland Moers edited this page Jun 19, 2014 · 1 revision

RMStepsController interprets taps on a certain step in the steps bar as the intention of the user to switch to that step. By default only going backwards is possible.

But sometimes the default behaviour is not wanted. In those cases RMStepsController can be subclassed and two methods can be overwritten to change the default behaviour.

The two methods are:

  • - (void)stepsBarDidSelectCancelButton:(RMStepsBar *)bar
  • - (void)stepsBar:(RMStepsBar *)bar shouldSelectStepAtIndex:(NSInteger)index

To select a certain step in the latter method your implementation can look like follows:

- (void)stepsBar:(RMStepsBar *)bar shouldSelectStepAtIndex:(NSInteger)index {
    [self showStepViewController:[self.childViewControllers objectAtIndex:index] animated:YES];
}

Where self.childViewControllers contains the content view controllers of all steps ordered by the step number.