victorBaro / VBFPopFlatButton

Flat button with 9 different states using POP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VBFPopFlatButton as UIBarButtonItem

sashakid opened this issue · comments

Hi, when I added VBFPopFlatButton as UIBarButtonItem, the all touches are not recognized from first time – it's very bad triggered.
My try was in that way:

        self.addTaskButton = [[VBFPopFlatButton alloc]initWithFrame:CGRectMake(0, 0, 25, 25) buttonType:buttonAddType buttonStyle:buttonPlainStyle animateToInitialState:YES];
        self.addTaskButton.lineThickness = 2;
        self.addTaskButton.tintColor = [UIColor whiteColor];
        [self.addTaskButton addTarget:self
                               action:@selector(addTask)
                     forControlEvents:UIControlEventTouchUpInside];
        self.addTaskButton.contentMode = UIViewContentModeCenter;

        UIView *containingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
//        UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(addTask)];
//        [containingView addGestureRecognizer:singleFingerTap];
        [containingView addSubview:self.addTaskButton];
        UIBarButtonItem *containingBarButton = [[UIBarButtonItem alloc] initWithCustomView:containingView];
        self.navigationItem.rightBarButtonItem = containingBarButton;

Then I tried to make containing view tappable and increase its area but this didn't help.
I know that UIButton and UIBarButtonItem are the different things but maybe someone could help me to make VBFPopFlatButton work as normal default UIBarButtonItem and make it excellent triggering? Thanks.