polobymulberry / animated-tab-bar-Objective-C

PJXAnimatedTabBarController is a Objective-C version of RAMAnimatedTabBarController(https://github.com/Ramotion/animated-tab-bar), also you can learn more about Ramotion from https://ramotion.com
MIT License
35 stars 17 forks source link

support Programmatic without storyboard or nib #1

Closed daemonchen closed 8 years ago

daemonchen commented 8 years ago

can support Programmatic without storyboard or nib?

polobymulberry commented 8 years ago

I have committed a version that support programmatic without storyboard or nib. You can find this code in TabBarViewController.m for example:

    // First ViewController
    PJXBounceAnimation *bounceAnimation = [[PJXBounceAnimation alloc] init];
    bounceAnimation.textSelectedColor = [UIColor blueColor];
    bounceAnimation.iconSelectedColor = [UIColor blueColor];

    PJXAnimatedTabBarItem *firstTabBarItem = [[PJXAnimatedTabBarItem alloc] initWithTitle:@"Bounce Animation" image:[UIImage imageNamed:@"drop"] selectedImage:nil];
    firstTabBarItem.animation = bounceAnimation;
    firstTabBarItem.textColor = [UIColor greenColor];
    UIImageView *firstIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"drop"]];
    UILabel *firstLabel = [[UILabel alloc] init];
    firstLabel.text = @"Bounce Animation";
    firstTabBarItem.iconView = [[PJXIconView alloc] initWithIcon:firstIconView textLabel:firstLabel];

    FirstViewController *firstViewController = [[FirstViewController alloc] init];
    UINavigationController *firstNav = [[UINavigationController alloc] initWithRootViewController:firstViewController];
    firstNav.tabBarItem = firstTabBarItem;
    self.viewControllers = @[firstNav];

    [super viewDidLoad];