导航栏视图设置 tabbleView 是设置总背景图

//导航栏视图设置 tabbleView 是设置总背景图

//默认的时白色半透明(有点灰的感觉), UIBarStyleBlack,UIBarStyleBlackTranslucent ,UIBarStyleBlackOpaque都是黑色半透明,其实它们 有的时不透明有的时透明有的时半透明,但不知为何无效 果

// self.navigationController.navigation Bar.barStyle=UIBarStyleBlackOpaque;

//设置导航条背景颜色,也是半透明玻璃状的颜色效 果

// self.navigationController.navigation Bar.backgroundColor=[UIColor orangeColor];

[self.navigationController.navigationB ar setBackgroundImage:[UIImage imageNamed:@"daoheng"] forBarMetrics:UIBarMetricsDefault ];

//导航栏视图设置

self.titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 64)];

//创建导航视图按钮 [self buttonView];

//导航栏视图设置

self.titleView= [[UIViewalloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 64)];

//创建导航视图按钮 [self buttonView];

self.navigationItem.titleView = self.titleView;

//tabbleView 是设置总背景图

UIImageView*tableBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellBG"]];

tableBg.alpha = 0.9; [self.tableView

setBackgroundView:tableBg]; [self.tableView

setBackgroundColor:[UIColor clearColor]];

#pragma mark导航视图按钮实现 - (void)buttonView
{

self.videoBtn = [UIButton buttonWithType:UIButtonTypeCustom];

[self.videoBtn setTitle:@"视频" forState:UIControlStateNormal];

self.videoBtn.frame =CGRectMake(kScreenWidth / 3 * 2 - 30, 10, 70, 30);

self.videoBtn.backgroundColor = [UIColor grayColor];

[self.videoBtn.layer setMasksToBounds:YES];

[self.videoBtn.layer setCornerRadius:15];

[self.videoBtn.layer setBorderWidth:1.0];

[self.videoBtn.layer setBorderColor:(__bridge CGColorRef)([UIColor redColor])];

[self.videoBtn addTarget:self action:@selector(video) forControlEvents:UIControlEventTouchUpInsi de];

[self.titleView addSubview:self.videoBtn];

self.messageBtn = [UIButton buttonWithType:UIButtonTypeCustom];

[self.messageBtn setTitle:@"资讯" forState:UIControlStateNormal];

self.messageBtn.tintColor = [UIColor purpleColor];

self.messageBtn.frame =CGRectMake(kScreenWidth / 3 - 30 , 10, 70 ,30); self.messageBtn.backgroundColo r = [UIColor grayColor];

[self.messageBtn.layer setMasksToBounds:YES];

[self.messageBtn.layer setCornerRadius:15];

[self.messageBtn.layer setBorderWidth:1.0];

[self.messageBtn.layer setBorderColor:(__bridge CGColorRef)([UIColor redColor])];

[self.titleView addSubview:self.messageBtn];

}

#pragma mark 下方视图 - (void)createView {

self.wishTableV = [[UITableView alloc] initWithFrame:CGRectMake(0, 250, kScreenWidth, kScreenHeight - 294)];

self.wishTableV.rowHeight = 100;

self.wishTableV.delegate = self; self.wishTableV.dataSource = self; self.wishTableV.backgroundColor =

[UIColor clearColor];
UIImageView *tableBg = [[UIImageView

alloc] initWithImage:[UIImage imageNamed:@"xuyuan"]];

tableBg.alpha = 0.9;

[self.wishTableV setBackgroundView:tableBg];

[self.wishTableV setBackgroundColor:[UIColor clearColor]];

[self.view addSubview:self.wishTableV]; } 

原文地址:https://www.cnblogs.com/lidongxiao/p/4949967.html