【发布时间】:2011-06-22 20:02:26
【问题描述】:
这就是我的工作
- 使用 UIViewController 子类设置视图
- 转到 IB,然后将视图拉入 iphone
- 在 UIView 上拉一个导航栏
- 在下面的空白处拉一个tableview。
当我运行界面生成器时,一切正常。
但是这些东西不起作用。
如果我在导航栏顶部添加一个按钮,该按钮会出现,但不会调用 IBAction。该按钮似乎位于导航栏下方(其他地方)
-
如果我为 tableView 添加页脚视图,它不会出现。我相信 UIView 再次掩盖了它或其他东西......
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { UIView *viewForFooter = [[UIView alloc] init ]; UIButton *footerButton = [[UIButton alloc] initWithFrame:CGRectMake(200, 40, 100, 40)]; footerButton.titleLabel.text = @"Forgot Login"; //self.forgotLogin = footerButton; [viewForFooter addSubview:footerButton]; return viewForFooter; }
为什么?
【问题讨论】:
-
您必须使用 IB 将按钮链接到选择器。你做到了吗?
-
你在设置表格视图的委托和数据源吗?另外,您是否设置了
UINavigationController? -
请编辑您之前的帖子UIBarButtonItem not reacting to click,而不是针对同样的问题发布新帖子。
-
一切正常。 !
-
为什么不直接做一个 UITableViewController?
标签: iphone objective-c cocoa-touch uiviewcontroller interface-builder