有没有办法像下图那样在 NavigationBar
中插入任何 UIView
?
最佳答案
这行不通吗?
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 20.0f, 320.0f, 32.0f)];
UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
[[self view] addSubview: tempView];
[[self view] addSubview: navBar];
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle: @"Controls"];
[navBar pushNavigationItem:navItem animated:NO];
关于ios - 如何像这样在 iOS7+ 中将自定义 UIView 添加到导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28702306/