双表联动

先导入第三方 SCNavTabBar

在viewcontroller.h中添加属性
@property(nonatomic,strong)NSString *provie;

然后再创建几个Viewcontroller
要几个窗 就创建几个

导入头文件

#import “SCNavTabBarController.h”

self.navigationItem.title = @"";
NSDictionary *dic = @{NSForegroundColorAttributeName :[UIColor whiteColor],NSFontAttributeName :[UIFont systemFontOfSize:15]};

self.navigationController.navigationBar.titleTextAttributes = dic;



self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@""] style:UIBarButtonItemStyleDone target:self action:@selector(aaa)];



self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@""] style:UIBarButtonItemStyleDone target:self action:@selector(bbb)];


self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@""]];


dancheViewController *cw = [dancheViewController new];
cw.title = @"";


haohuacheViewController *et = [haohuacheViewController new];
et.title = @"";

kuaicheViewController *sh= [kuaicheViewController new];
sh.title = @"";

lichengViewController *ty = [lichengViewController new];
ty.title = @"";

chuzuViewController *dcd = [chuzuViewController new];
dcd.title = @"";

oneViewController *w = [oneViewController new];
w.title = @"";

twoViewController *ss = [twoViewController new];
ss.title = @"";


// 创建SCNavTabBar
SCNavTabBarController *scNav = [SCNavTabBarController new];
//    scNav.d
scNav.subViewControllers = @[cw , et , sh , ty , dcd , w, ss];

// 设置背景颜色
[scNav setNavTabBarColor:[UIColor whiteColor]];
// 执行管理
[scNav addParentController:self];



// 设置搜索框
UISearchBar *sear = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, 150, 40)];
sear.placeholder = @" ";
UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(330, 15, 50, 30)];
[btn setImage:[UIImage imageNamed:@"rs"] forState:UIControlStateNormal];
[sear addSubview:btn];
self.navigationItem.titleView = sear;

猜你喜欢

转载自blog.csdn.net/WNEHIUZHNAG/article/details/84346968