171 lines
7.5 KiB
Objective-C
171 lines
7.5 KiB
Objective-C
//
|
|
// TabBarPickerViewController.m
|
|
// TabBarPicker
|
|
//
|
|
// Created by Giuseppe Nucifora on 07/15/2015.
|
|
// Copyright (c) 2015 Giuseppe Nucifora. All rights reserved.
|
|
//
|
|
|
|
#import "TabBarPickerViewController.h"
|
|
#import "TabBarPicker.h"
|
|
#import <PureLayout/PureLayout.h>
|
|
|
|
@interface TabBarPickerViewController () {
|
|
TabBarPicker *tabbar;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation TabBarPickerViewController
|
|
|
|
|
|
- (instancetype) init {
|
|
self = [super init];
|
|
|
|
if (self) {
|
|
|
|
TabBarSubItem *subItem1 = [TabBarSubItem tabBarSubItemWithName:@"Peppe" andValue:@"Peppe"];
|
|
TabBarSubItem *subItem2 = [TabBarSubItem tabBarSubItemWithName:@"Peppe1" andValue:@"Peppe1"];
|
|
TabBarSubItem *subItem3 = [TabBarSubItem tabBarSubItemWithName:@"Peppe2" andValue:@"Peppe2"];
|
|
TabBarSubItem *subItem4 = [TabBarSubItem tabBarSubItemWithName:@"Peppe3" andValue:@"Peppe3"];
|
|
TabBarSubItem *subItem5 = [TabBarSubItem tabBarSubItemWithName:@"Peppe4" andValue:@"Peppe4"];
|
|
TabBarSubItem *subItem6 = [TabBarSubItem tabBarSubItemWithName:@"Peppe5" andValue:@"Peppe5"];
|
|
TabBarSubItem *subItem7 = [TabBarSubItem tabBarSubItemWithName:@"Peppe6" andValue:@"Peppe6"];
|
|
|
|
TabBarPickerSubItemsView *locationSubview = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:YES];
|
|
|
|
TabBarItem *location = [[TabBarItem alloc] initWithSubItemView:locationSubview];
|
|
[location setItemName:@"Location"];
|
|
[location setImage:[UIImage imageNamed:@"location"]];
|
|
[location setSelectedImage:[UIImage imageNamed:@"location_selected"]];
|
|
[location setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
|
|
|
|
TabBarPickerSubItemsView *calendarSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7]];
|
|
|
|
TabBarItem *calendar = [[TabBarItem alloc] initWithSubItemView:calendarSubView];
|
|
[calendar setItemName:@"Calendar"];
|
|
[calendar setImage:[UIImage imageNamed:@"calendar"]];
|
|
[calendar setSelectedImage:[UIImage imageNamed:@"calendar_selected"]];
|
|
[calendar setHighlightedImage:[UIImage imageNamed:@"calendar_highlighted"]];
|
|
|
|
TabBarPickerSubItemsView *typeSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7]];
|
|
|
|
TabBarItem *type = [[TabBarItem alloc] initWithSubItemView:typeSubView];
|
|
[type setItemName:@"Type"];
|
|
[type setImage:[UIImage imageNamed:@"type"]];
|
|
[type setSelectedImage:[UIImage imageNamed:@"type_selected"]];
|
|
[type setHighlightedImage:[UIImage imageNamed:@"type_highlighted"]];
|
|
|
|
TabBarPickerSubItemsView *priceSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7]];
|
|
|
|
TabBarItem *price =[[TabBarItem alloc] initWithSubItemView:priceSubView];
|
|
[price setItemName:@"Price"];
|
|
[price setImage:[UIImage imageNamed:@"price"]];
|
|
[price setSelectedImage:[UIImage imageNamed:@"price_selected"]];
|
|
[price setHighlightedImage:[UIImage imageNamed:@"price_highlighted"]];
|
|
|
|
TabBarPickerSubItemsView *allergenSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7]];
|
|
|
|
TabBarItem *allergen = [[TabBarItem alloc] initWithSubItemView:allergenSubView];
|
|
[allergen setItemName:@"Allergen"];
|
|
[allergen setImage:[UIImage imageNamed:@"allergen"]];
|
|
[allergen setSelectedImage:[UIImage imageNamed:@"allergen_selected"]];
|
|
[allergen setHighlightedImage:[UIImage imageNamed:@"allergen_highlighted"]];
|
|
|
|
/*TabBarItem *allergen2 = [[TabBarItem alloc] initWithSubItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7]];
|
|
[allergen2 setItemName:@"Allergen"];
|
|
[allergen2 setImage:[UIImage imageNamed:@"allergen"]];
|
|
[allergen2 setSelectedImage:[UIImage imageNamed:@"allergen_selected"]];
|
|
*/
|
|
tabbar = [[TabBarPicker alloc] initWithTabBarItems:@[location,calendar,type,price,allergen] forPosition:TabBarPickerPositionBottom];
|
|
[tabbar setItemSpacing:0];
|
|
[tabbar setBackgroundColor:[UIColor whiteColor]];
|
|
|
|
//[tabbar addItem:allergen2];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void) loadView {
|
|
|
|
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
|
|
[contentView setBackgroundColor:[UIColor lightGrayColor]];
|
|
|
|
[contentView addSubview:tabbar];
|
|
|
|
self.view = contentView;
|
|
|
|
[self.view setNeedsUpdateConstraints];
|
|
}
|
|
|
|
- (void)viewDidLoad
|
|
{
|
|
[super viewDidLoad];
|
|
|
|
//[self.view setBackgroundColor:[UIColor lightGrayColor]];
|
|
// Do any additional setup after loading the view, typically from a nib.
|
|
}
|
|
|
|
- (void) viewDidAppear:(BOOL)animated {
|
|
|
|
//[tabbar selectItem:0];
|
|
|
|
/*TabBarSubItem *subItem1 = [TabBarSubItem tabBarSubItemWithName:@"Peppe"];
|
|
TabBarSubItem *subItem2 = [TabBarSubItem tabBarSubItemWithName:@"Peppe1"];
|
|
TabBarSubItem *subItem3 = [TabBarSubItem tabBarSubItemWithName:@"Peppe2"];
|
|
TabBarSubItem *subItem4 = [TabBarSubItem tabBarSubItemWithName:@"Peppe3"];
|
|
TabBarSubItem *subItem5 = [TabBarSubItem tabBarSubItemWithName:@"Peppe4"];
|
|
TabBarSubItem *subItem6 = [TabBarSubItem tabBarSubItemWithName:@"Peppe5"];
|
|
TabBarSubItem *subItem7 = [TabBarSubItem tabBarSubItemWithName:@"Peppe6"];
|
|
|
|
TabBarItem *allergen = [[TabBarItem alloc] initWithSubItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7]];
|
|
[allergen setItemName:@"Allergen"];
|
|
[allergen setImage:[UIImage imageNamed:@"allergen"]];
|
|
[allergen setSelectedImage:[UIImage imageNamed:@"allergen_selected"]];
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar addItem:allergen];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar show];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(6 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar hide];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(9 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar show];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar hide];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar show];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(18 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar hide];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(21 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar show];
|
|
});
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(24 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[tabbar hide];
|
|
});*/
|
|
}
|
|
|
|
- (void)didReceiveMemoryWarning
|
|
{
|
|
[super didReceiveMemoryWarning];
|
|
// Dispose of any resources that can be recreated.
|
|
}
|
|
|
|
@end
|