giridharvc7 / VCFloatingActionButton

A Floating Action Button just like Google inbox for iOS
MIT License
296 stars 77 forks source link

How can I make a new delegate for clicked in VCFloatingActionButton itself. #15

Closed afiq90 closed 8 years ago

afiq90 commented 8 years ago

Hey guys, how can I add another delegate that when i click on VCFloatingActionButton it self? What I wanna do is when I click on VCFloationgActionButton I want present another view controller. thanks in advance.

giridharvc7 commented 8 years ago

Hi afiq, I assume you are asking for a behaviour similar to the google inbox FAB.

In the -(void)handleTap:(id)sender function,

if (_isMenuVisible)
    {
       // Add your delegate here
      // Hide the buttons 
    }
afiq90 commented 8 years ago

how can I make those delegate. sorry I'm novice in iOS dev. thanks. :)

giridharvc7 commented 8 years ago

Thats okay

In the VCFloatingActionButton.h file, add these lines in the @protocol

@optional
-(void) didSelectMenuOptionAtIndex:(NSInteger)row;
-(void) didPressSelf; // Or anyother name you want
@end

.m file

if(_isMenuVisible)
{
    [delegate didPressSelf];  //or the name you've given
}
afiq90 commented 8 years ago

thank you, it's working now.

giridharvc7 commented 8 years ago

You are welcome :+1: