implement iOS navbar custom left & right view

This commit is contained in:
王劲鹏
2020-01-10 17:40:43 +08:00
committed by osborn
parent 894f23cd5b
commit 26d32d788e
3 changed files with 82 additions and 0 deletions

View File

@@ -103,5 +103,15 @@ - (void)doric_navBar_setBackgroundColor:(UIColor *)color {
[self.navigationController.navigationBar setBackgroundImage:UIImageWithColor(color) forBarMetrics:UIBarMetricsDefault];
}
- (void)doric_navBar_setLeft:(UIView *)view {
UIBarButtonItem *custom = [[UIBarButtonItem alloc] initWithCustomView:view];
self.navigationItem.leftBarButtonItem = custom;
}
- (void)doric_navBar_setRight:(UIView *)view {
UIBarButtonItem *custom = [[UIBarButtonItem alloc] initWithCustomView:view];
self.navigationItem.rightBarButtonItem = custom;
}
@end