首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在tableView前面设置的UITableViewController net中添加了按钮

在tableView前面设置的UITableViewController net中添加了按钮
EN

Stack Overflow用户
提问于 2012-09-17 21:42:45
回答 5查看 220关注 0票数 0

我以编程方式将一个按钮添加到UITableViewController中,如下所示:

代码语言:javascript
运行
复制
-(void)createFlipButton
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoDark];
    button.frame = CGRectMake(282, 372, 18, 19);
    [button addTarget:self action:@selector(flipView) forControlEvents:UIControlEventTouchDown];
    [self.view addSubview:button];
    [self.view bringSubviewToFront:button];
}

但是它被卡在了占用button.frame空间的单元中。为什么[self.view bringSubviewToFront:button]不能工作?

而且,[self.tableView bringSubviewToFront:button]也不能工作。

EN

Stack Overflow用户

发布于 2012-09-26 03:31:43

您可以创建一个透明的UIView;将您的按钮添加到该UIView,然后将该UIView添加到您拥有的视图层次结构中。这应该按照你的要求工作(按钮不是表视图的一部分)。如果需要示例代码的任何帮助,请在下面添加注释。

票数 0
EN
查看全部 5 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12460545

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档