您是否知道任何教程/项目以 Apple 在 AppStore -> 应用程序详细信息页面中的方式实现选项卡?这就是我的意思:
我当然可以自己写,但我想知道以前是否没有这样的想法。
谢谢!
你应该看看: http: //www.cocoacontrols.com/platforms/ios/controls/sdwellsegmentedcontrol,非常有用!
洛里斯
在您的情况下,您需要创建UIView
or UIImageView
with frame (0, 35, self.view.bounds.size.width, 36)并添加 Three UIButton
。UIButton
并为Both forState:UIControlStateNormal
和设置背景图像forState:UIControlStateHighlighted
。为了更好地理解,我还为 You 编写了以下代码。
UIImageView *imgHeading = [[UIImageView alloc] initWithFrame:CGRectMake(0, 35, self.view.bounds.size.width, 36)] ;
[imgHeading setImage: [UIImage imageNamed:@"NameOfImage"]];
[self.view addSubview: imgHeading];
UIButton *btnHome = [UIButton buttonWithType:UIButtonTypeCustom];
[btnHome addTarget:self action:@selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
btnHome.frame = CGRectMake(as you need);
[btnHome setBackgroundImage:[UIImage imageNamed:@"NameOfImage"] forState:UIControlStateNormal];
[btnHome setBackgroundImage:[UIImage imageNamed:@"NameOfImage"] forState:UIControlStateHighlighted];
[self.view addSubview:btnHome];
UIButton *btnHome1 = [UIButton buttonWithType:UIButtonTypeCustom];
[btnHome1 addTarget:self action:@selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
btnHome1.frame = CGRectMake(as you need);
[btnHome1 setBackgroundImage:[UIImage imageNamed:@"NameOfImage"] forState:UIControlStateNormal];
[btnHome1 setBackgroundImage:[UIImage imageNamed:@"NameOfImage"] forState:UIControlStateHighlighted];
[self.view addSubview:btnHome1];
UIButton *btnHome2 = [UIButton buttonWithType:UIButtonTypeCustom];
[btnHome2 addTarget:self action:@selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
btnHome2.frame = CGRectMake(as you need);
[btnHome2 setBackgroundImage:[UIImage imageNamed:@"NameOfImage"] forState:UIControlStateNormal];
[btnHome2 setBackgroundImage:[UIImage imageNamed:@"NameOfImage"] forState:UIControlStateHighlighted];
[self.view addSubview:btnHome2];
谢谢,可能对你有帮助:)