【发布时间】:2014-05-24 20:58:01
【问题描述】:
我添加了一个 UIView 作为导航栏的子视图,并调整了它的大小使其看起来像一个工具栏。
它将包含 3 个按钮:
- 用于更改集合视图中服装项目的样式
- 一个用于过滤结果,例如最爱、推荐等
- 一个用于优化结果
我更喜欢创建这些按钮并在界面生成器中进行所有编辑。这可能吗?
这是我当前用于创建视图的代码:
@interface MyCollectionViewController () <UIScrollViewDelegate>
@property (nonatomic, weak) UIView *filterBar;
@end
@implementation MyCollectionViewController
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
UIView *filterBar = [[UIView alloc] initWithFrame:CGRectMake(0, 42, self.view.frame.size.width, self.navigationController.navigationBar.frame.size.height)];
[[[self navigationController] navigationBar] addSubview:filterBar];
[filterBar setBackgroundColor:[[UIColor whiteColor] colorWithAlphaComponent:0.9f]];
[filterBar setTag:1];
}
我的按钮将类似于触发 UIActionSheet 实例或将其他控制器推送到堆栈顶部的选择按钮,在那里我可以提供执行操作的界面,例如细化衣服类型然后搜索。
这是我正在谈论的带有栏的应用的照片:
无论如何,这是否可能,我可以将我在上面的代码中创建的视图链接到界面构建器中,并以可视方式而不是在代码中处理它吗?
感谢您的宝贵时间。
亲切的问候
【问题讨论】:
标签: ios objective-c xcode cocoa-touch uiview