Skip to content

Commit

Permalink
Merge pull request #6 from wilferrel/master
Browse files Browse the repository at this point in the history
Fixes #5 Allow Opening Items Upward or Downward
  • Loading branch information
pakmee committed Feb 16, 2015
2 parents f4cb899 + 7daa45c commit 5144a20
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion FancyTabBar/FancyTabBar.h
Expand Up @@ -8,10 +8,18 @@
#import <UIKit/UIKit.h>
#import "FancyTabBarDelegate.h"

typedef enum {
FancyTabBarItemsPop_Up,
FancyTabBarItemsPop_Down
} FancyTabBarItemsPopDirection;

@interface FancyTabBar : UIView{

}

/**
* Set the direction you want to the choices to pop. This must be set before setting up choices.
*/
@property (assign, nonatomic) FancyTabBarItemsPopDirection currentDirectionToPopOptions;
@property(nonatomic,weak) id<FancyTabBarDelegate> delegate;

- (void) setUpChoices:(UIViewController*) parentViewController choices:(NSArray*) choices withMainButtonImage:(UIImage*)mainButtonImage;
Expand Down
4 changes: 4 additions & 0 deletions FancyTabBar/FancyTabBar.m
Expand Up @@ -173,6 +173,10 @@ - (void) calculateExpandedCoordinates{
int tag = (i+1)*subviewTagConstant;
Coordinate *coordinate = [[Coordinate alloc] init];
float radian = (degrees*(i)*M_PI)/180;
if (_currentDirectionToPopOptions==FancyTabBarItemsPop_Down) {
//Pop Option Buttons Down
radian = (degrees*(i)*M_PI)/-180;
}
float cosineRadian = cosf(radian);
float sineRadian = sinf(radian);

Expand Down
6 changes: 4 additions & 2 deletions FancyTabBar/ViewController.m
Expand Up @@ -25,8 +25,10 @@ - (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_fancyTabBar = [[FancyTabBar alloc]initWithFrame:self.view.bounds];
[_fancyTabBar setUpChoices:self choices:@[@"gallery",@"dropbox",@"camera",@"draw"] withMainButtonImage:[UIImage imageNamed:@"main_button"]];
//Custom Placement
[_fancyTabBar setUpChoices:self choices:@[@"gallery",@"dropbox",@"camera",@"draw"] withMainButtonImage:[UIImage imageNamed:@"main_button"]];
// //Set Pop Items Direction
// _fancyTabBar.currentDirectionToPopOptions=FancyTabBarItemsPop_Down;
// //Custom Placement
// [_fancyTabBar setUpChoices:self choices:@[@"gallery",@"dropbox",@"camera",@"draw"] withMainButtonImage:[UIImage imageNamed:@"main_button"] andMainButtonCustomOrigin:CGPointMake(100, 100)];
_fancyTabBar.delegate = self;
[self.view addSubview:_fancyTabBar];
Expand Down

0 comments on commit 5144a20

Please sign in to comment.