我需要与UIView覆盖UINavigationBar像这里
http://screencast.com/t/ZKXNFcAzVu\u0026amp;gt;\”\u0026gt;
有没有办法这样做,除了使用自定义UIView与按钮返回作为导航栏?
解决方法
您可以将子视图添加到应用程序的基本视图
[[[UIApplication sharedApplication] keyWindow] addSubview:vMyCustomUIView];
为了确保只有当您的视图控制器可见时才会显示,您可以在viewDidAppear和viewDidDisappern委托方法中添加和删除它.这是一个示例,它将显示一个与其重叠的蓝色框.
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. vTestView = [[UIView alloc] initWithFrame:CGRectMake(10.0f,10.0f,100.0f,100.0f)]; vTestView.backgroundColor = [UIColor blueColor]; } -(void)viewDidAppear:(BOOL)animated { [[[UIApplication sharedApplication] keyWindow] addSubview:vMyCustomUIView]; } -(void)viewDidDisappear:(BOOL)animated { [vMyCustomUIView removeFromSuperview]; }