博客> navigation 栏的一些设置
navigation 栏的一些设置
2小时前 评论:0 阅读:536 我是一棵树丶
ios navigation

//有时候,使用navigationController push的时候,会出现阴影,给navigationController的view一个背景色就可以解决

self.navigationController.view.backgroundColor = [UIColor whiteColor]; //设置navigationController的title

self.navigationItem.title =@"我的词汇";

//设置navigationController的title的标题字体的颜色和大小

[self.navigationController.navigationBarsetTitleTextAttributes: @{NSFontAttributeName:[UIFont systemFontOfSize:19],NSForegroundColorAttributeName:[[UIColor alloc]initWithRed:0 green:0 blue:0 alpha:1]}];

//设置navigationController的两边文字的颜色

self.navigationController.navigationBar.tintColor = [[UIColor alloc]initWithRed:0 green:0 blue:0 alpha:1];

// 设置navigationController左边的item

UIBarButtonItem *left = [[UIBarButtonItemalloc]initWithTitle:@"返回"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(clickReply)]; self.navigationItem.leftBarButtonItem = left;

// 设置navigationController右边的item

UIBarButtonItem *rightItem = [[UIBarButtonItemalloc]initWithTitle:@"编辑词汇"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(clickEdit)]; self.navigationItem.rightBarButtonItem = rightItem;

//设置navi和状态栏颜色

[[UINavigationBarappearance] setBarTintColor:[[UIColoralloc]initWithRed:39/255.0green:42/255.0blue:47/255.0alpha:1]];

//设置状态栏字体颜色,在info.plist中添加一个字段:view controller -base status bar 设置为NO
[[UIApplicationsharedApplication] setStatusBarStyle:UIStatusBarStyleLightContentanimated:NO];

//设置左侧返回按钮没有文字 [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];

收藏
1
sina weixin mail 回到顶部