//
//  HistoryTabBarController.m
//  Apex Mobile
//
//  Created by Ray on 14-4-24.
//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
//

#import "HistoryTabBarController.h"

@interface HistoryTabBarController ()

@end

@implementation HistoryTabBarController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}
- (id)init
{
    self = [super init];
    if (self) {
        
        DebugLog(@"DetailTabBarController init.................");
        
        
        
        //        UITabBar *tabBar = self.tabBar;
        //        [tabBar setTintColor:[UIColor redColor]];
        
        //        [tabBar setTintColor:[UIColor colorWithRed:0.0
        //                                             green:176.0/255.0
        //                                              blue:226.0/255.0
        //                                             alpha:1.0]];
        //        tabBar.selectedImageTintColor = [UIColor clearColor];
        //        UITabBarItem *item = [tabBar.items objectAtIndex:0];
        //        NSString *homePath = [[NSBundle mainBundle] pathForResource:@"btn_home_highlight" ofType:@"png"];
        //        if(item.tag == 1)
        //        {
        //            [item setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
        //                                          [UIColor lightGrayColor], UITextAttributeTextColor, nil]
        //                                forState:UIControlStateNormal];
        //            item.selectedImage = [UIImage imageWithContentsOfFile:homePath];
        //        }
        
        
        self.navigationItem.title = @"Saved Detail/Search";
        
        NSMutableArray* controllers = [[NSMutableArray alloc]init];
        
        
        
        
        NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
        
        
        
        
        //            testViewController * one = [[testViewController alloc] init];
        
        UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:[NSBundle mainBundle]];
        
        UIOffset offset;
        offset.horizontal = 0;
        offset.vertical = -15;
        
        FavoritesViewController *detail = [storyboard instantiateViewControllerWithIdentifier:@"FavoritesViewController"];
        
        
        
        //                  [one setTitle:self.actions[i]];
        detail.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Saved detail" image:nil tag:1];//[[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:0];
        [detail.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIFont systemFontOfSize:12.0], NSFontAttributeName, nil]
                                         forState:UIControlStateNormal];
//        detail.module_name = @"Saved detail";
        //   one.tabBarItem set
        //            [one.tabBarItem setSelectedImage:[UIImage imageNamed:@"tag-3.png"]];
        
        [detail.tabBarItem setTitlePositionAdjustment:offset];
        
        
        
        
        HistoryViewController *search = [storyboard instantiateViewControllerWithIdentifier:@"HistoryViewController"];
        
        
        
        //                  [one setTitle:self.actions[i]];
        search.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Saved search" image:nil tag:1];//[[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:0];
        [search.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIFont systemFontOfSize:12.0], NSFontAttributeName, nil]
                                         forState:UIControlStateNormal];
        
//        search.module_name = @"Saved search";
        //   one.tabBarItem set
        //            [one.tabBarItem setSelectedImage:[UIImage imageNamed:@"tag-3.png"]];
        [search.tabBarItem setTitlePositionAdjustment:offset];
        //            one.tabBarItem set
        
        
        [controllers addObject:search];
        [controllers addObject:detail];
        
        
        
        self.viewControllers = controllers;
        UIImage* img = [UIImage imageNamed:@"test1.png"];
        UIImage * idimage=[img resizableImageWithCapInsets:UIEdgeInsetsMake(1.0f, 30.0f, 300.0f, 30.0f)];
        //tabBarController.tabBar.selectionIndicatorImage = idicImage;
        //        [self.tabBar setTintColor:[UIColor redColor]];
        //        [self.tabBar setItemSpacing:0];
        //        [self.tabBar setBarTintColor:[UIColor greenColor]];
        //        [self.tabBar setSelectedImageTintColor:[UIColor purpleColor]];
        self.tabBar.selectionIndicatorImage =idimage;
        
        
    }
    return self;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
