我以编程方式将一个按钮添加到UITableViewController中,如下所示:
-(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]也不能工作。
发布于 2012-09-26 03:31:43
您可以创建一个透明的UIView;将您的按钮添加到该UIView,然后将该UIView添加到您拥有的视图层次结构中。这应该按照你的要求工作(按钮不是表视图的一部分)。如果需要示例代码的任何帮助,请在下面添加注释。
https://stackoverflow.com/questions/12460545
复制相似问题