diff --git a/RaisedCenterTabBar/Classes/BaseViewController.h b/RaisedCenterTabBar/Classes/BaseViewController.h index 1842edd..70af326 100644 --- a/RaisedCenterTabBar/Classes/BaseViewController.h +++ b/RaisedCenterTabBar/Classes/BaseViewController.h @@ -33,6 +33,6 @@ -(UIViewController*) viewControllerWithTabTitle:(NSString*)title image:(UIImage*)image; // Create a custom UIButton and add it to the center of our tab bar --(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*)highlightImage; +-(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*)highlightImage target:(id)target action:(SEL)action; @end diff --git a/RaisedCenterTabBar/Classes/BaseViewController.m b/RaisedCenterTabBar/Classes/BaseViewController.m index 7a20eb9..57a71a3 100644 --- a/RaisedCenterTabBar/Classes/BaseViewController.m +++ b/RaisedCenterTabBar/Classes/BaseViewController.m @@ -38,7 +38,7 @@ -(UIViewController*) viewControllerWithTabTitle:(NSString*) title image:(UIImage } // Create a custom UIButton and add it to the center of our tab bar --(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*)highlightImage +-(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*)highlightImage target:(id)target action:(SEL)action { UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin; @@ -55,6 +55,8 @@ -(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*) center.y = center.y - heightDifference/2.0; button.center = center; } + + [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; } diff --git a/RaisedCenterTabBar/Classes/DailyBoothViewController.m b/RaisedCenterTabBar/Classes/DailyBoothViewController.m index f765cda..c84097c 100644 --- a/RaisedCenterTabBar/Classes/DailyBoothViewController.m +++ b/RaisedCenterTabBar/Classes/DailyBoothViewController.m @@ -43,7 +43,12 @@ - (void)viewDidLoad -(void)willAppearIn:(UINavigationController *)navigationController { - [self addCenterButtonWithImage:[UIImage imageNamed:@"camera_button_take.png"] highlightImage:[UIImage imageNamed:@"tabBar_cameraButton_ready_matte.png"]]; + [self addCenterButtonWithImage:[UIImage imageNamed:@"camera_button_take.png"] highlightImage:[UIImage imageNamed:@"tabBar_cameraButton_ready_matte.png"] target:self action:@selector(buttonPressed:)]; } +- (void)buttonPressed:(id)sender { + NSLog(@"the button was pressed"); +} + + @end diff --git a/RaisedCenterTabBar/Classes/InstagramViewController.m b/RaisedCenterTabBar/Classes/InstagramViewController.m index cabdea7..47b3896 100644 --- a/RaisedCenterTabBar/Classes/InstagramViewController.m +++ b/RaisedCenterTabBar/Classes/InstagramViewController.m @@ -43,7 +43,11 @@ - (void)viewDidLoad -(void)willAppearIn:(UINavigationController *)navigationController { - [self addCenterButtonWithImage:[UIImage imageNamed:@"cameraTabBarItem.png"] highlightImage:nil]; + [self addCenterButtonWithImage:[UIImage imageNamed:@"cameraTabBarItem.png"] highlightImage:nil target:self action:@selector(buttonPressed:)]; +} + +- (void)buttonPressed:(id)sender { + NSLog(@"the button was pressed"); } @end diff --git a/RaisedCenterTabBar/Classes/PathViewController.m b/RaisedCenterTabBar/Classes/PathViewController.m index 53f81c7..29b4500 100644 --- a/RaisedCenterTabBar/Classes/PathViewController.m +++ b/RaisedCenterTabBar/Classes/PathViewController.m @@ -43,7 +43,12 @@ - (void)viewDidLoad -(void)willAppearIn:(UINavigationController *)navigationController { - [self addCenterButtonWithImage:[UIImage imageNamed:@"capture-button.png"] highlightImage:nil]; + [self addCenterButtonWithImage:[UIImage imageNamed:@"capture-button.png"] highlightImage:nil target:self action:@selector(buttonPressed:)]; } +- (void)buttonPressed:(id)sender { + NSLog(@"the button was pressed."); +} + + @end