Respond to Double Tap SEssentialsTabHeaderView


Is there no easy way to respond to tap or double tap on a tab?  I want to edit title for the tab on double tap, or even single tap if the tab is already active. Alternatively, I have presented a popover with choices in response to touching delete icon. This wouldn’t be bad either except I cannot figure how to change that “x” icon beside the title to something more appropriate indicating options rather than delete.



I muddled about with custom SEssentialTabHeaders and such but I was not interested in completely reinventing the tab. I came up with simple solution that may help others.

Subclass SEssentialsTab, adding only one property-:

#import <UIKit/UIKit.h>
#import <ShinobiEssentials/ShinobiEssentials.h>

@interface YTRLaborTabHeaderView : SEssentialsTab
@property(nonatomic, weak)UITapGestureRecognizer *doubleTapRecognizer;

Then added these delegate methods in my SEssentialTabbedView Delegate:

-(void)tabbedView:(SEssentialsTabbedView *)tabbedView tabDidBecomeActive:(SEssentialsTab *)tab
    YTRLaborTabHeaderView *customTab = (YTRLaborTabHeaderView *)tab;
    UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandler:)];
    doubleTapRecognizer.numberOfTapsRequired = 2;
    doubleTapRecognizer.delaysTouchesBegan = YES;
    [customTab.tabHeaderView addGestureRecognizer:doubleTapRecognizer];
    customTab.doubleTapRecognizer = doubleTapRecognizer;

-(void)tabbedView:(SEssentialsTabbedView *)tabbedView tabDidBecomeInactive:(SEssentialsTab *)tab
    YTRLaborTabHeaderView *customTab = (YTRLaborTabHeaderView *)tab;
    [customTab.tabHeaderView removeGestureRecognizer:customTab.doubleTapRecognizer];
    customTab.doubleTapRecognizer = nil;

Every time a tab becomes active, the gesture recognizer is added to that tab. Removed when tab becomes inactive. So only the active tab receives double taps and initiates my gesture handler.


Hi Deansdavids,

The tab header itself doesn’t provide any direct support for editing the title, so adding your own gesture recognizer & implementing this yourself is definitely the right way to go.

Thanks for sharing that, for the benefit of others - it looks like a good solution to me.  :grin: