我正在设计一个基于iPhone的移动应用程序。我遇到的问题是,我在顶部有两个导航栏,我希望它们重叠。
有没有人可以跟我分享一种可能的方法。
请检查下面的设计理念。
发布于 2013-08-18 16:11:52
用标准方法是不可能的。您必须创建自定义导航栏。它可以是带有UIImage的UIView (类似于背景),也可以带有UIImage上的UIButton对象。例如,你创建了你的CustomNavBar类,它是UIView的子类,把它导入到你的根视图控制器中,然后用viewDidLoad编写:
CustomNavBar *bar1=[CustomNavBar alloc]initWithFrame:CGRectMake(0,0,320,25)];
UIImage *background1=[UIImage imageNamed:@"bg1.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(aMethod:)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(5, 5, 20, 10);
[bar1 addSubview:background1];
[bar1 addSubview:button];
https://stackoverflow.com/questions/18296893
复制相似问题