为ViewController
您拥有 subView 的地方执行以下操作NavigationBar
在.h
@property (nonatomic, retain) UIView *mySubView;
在.m
- (void)viewDidLoad {
//Your Existing Code + following 2 lines
self.mySubView = [[UIView alloc] initWithFrame:yourFrame];
self.mySubView.backgroundColor = [UIColor whiteColor];
}
- (void)viewWillAppear:(BOOL)animated {
//Your Existing Code + following 1 line
[self.navigationController.navigationBar addSubview:self.mySubView];
}
- (void)viewWillDisappear:(BOOL)animated {
//Your Existing Code + following 1 line
[self.mySubView removeFromSuperview];
}
你很高兴。尝试和测试。