Delegate

TKTabView will notify its TKTabViewDelegate before and after a tab selection occurs. Also the delegate will ask for a tab's content view if it does not have one.

Here is an example implementation of the selection notifications:

- (BOOL) tabViewWillSelectTab: (TKTab *) tab {
    if([tab.title compare: @"Tab 2"] == 0) {
        NSLog(@"%@", @"Can't select Tab 2");

        // Return YES to cancel selection.
        return YES;
    }

    NSLog(@"Will select %@.", tab.title);

    return NO;
}

- (void) tabViewDidSelectTab: (TKTab *) tab {
    NSLog(@"Did select %@.", tab.title);
}

Content view callback example:

- (UIView *) contentViewForTab: (TKTab *) tab {
    UILabel *label = [UILabel new];
    label.textColor = [UIColor blackColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.text = [NSString stringWithFormat:@"Content view for %@.", tab.title];
    return label;
}