#import "GCControView.h"
#import "GCTools.h"
#import "GCControlView_1.h"
@implementation GCControView
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.view.backgroundColor = [UIColor orangeColor];
UIButton *btn = [GCTools ButtonViewWithTitle:@"VIewTO" andUIButtonType:UIButtonTypeCustom andControlState:UIControlStateNormal andBackgroundColor:[UIColor brownColor] anPointofX:10 anPointofY:100 andWidth:100 andHeight:20 andSuperView:nil andTag:1];
[self.view addSubview:btn];
[btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
//设置导航条的标题:居中显示
[self.navigationItem setTitle:@"view1"];
//设置标题栏的背景图片
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"image3.png"] forBarMetrics:UIBarMetricsDefault];
//设置标题栏的按钮,
UIBarButtonItem *barbtn_1 = [[UIBarButtonItem alloc] initWithTitle:@"Left" style:UIBarButtonItemStylePlain target:self action:@selector(barClick)];
UIBarButtonItem *barbtn_2 = [[UIBarButtonItem alloc] initWithTitle:@"Left" style:UIBarButtonItemStylePlain target:self action:@selector(bar_2Click)];
UIButton *btnitem = [GCTools ButtonViewWithTitle:@"Item" andUIButtonType:UIButtonTypeCustom andControlState:UIControlStateNormal andBackgroundColor:[UIColor redColor] anPointofX:20 anPointofY:20 andWidth:100 andHeight:44 andSuperView:nil andTag:1];
UIBarButtonItem *barbtn_3 = [[UIBarButtonItem alloc] initWithCustomView:btnitem];
UIBarButtonItem *barbtn_4 = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Checkers.png"] style:UIBarButtonItemStylePlain target:self action:nil];
//设置标题栏的左按钮。
NSArray *ary = [[NSArray alloc] initWithObjects:barbtn_1,barbtn_2,barbtn_3,barbtn_4, nil];
[self.navigationItem setLeftBarButtonItem:barbtn_1];
[self.navigationItem setRightBarButtonItem:barbtn_4];
// [self.navigationItem setRightBarButtonItems:ary];
//设置标题栏的背景颜色。
self.navigationController.navigationBar.barStyle =UIBarStyleBlack;
}
-(void)barClick{
self.view.backgroundColor = [UIColor greenColor];
}
-(void)bar_2Click{
self.view.backgroundColor = [UIColor greenColor];
}
-(void)bar_3Click{
self.view.backgroundColor = [UIColor greenColor];
}