UIButton延迟&奇怪的工具栏行为

时间:2014-01-30 11:17:04

标签: ios objective-c ios7

我有以下情况:

[viewController.view addSubview:_tableView];
[viewController.view addSubview:_footerBar]; // _footerBar is a UIToolbar so I 
                                             // get a blur-effect for free
[_footerBar addSubview:_myButton];

enter image description here

但是UIButton存在一个问题:当它被点击时需要0.5秒,直到它将其外观改为突出显示。

以下是修复它的一些尝试:

IDEA 1:

然而,当我将页脚放在_tableView标题上方时,情况并非如此!这导致了另一个发现:如果在将页脚添加到父页面之后分配页脚的框架,则会立即显示突出显示的状态。

延迟突出显示案例(BAD USER EXPERIENCE):

CGRect footerFrame = CGRectMake(...)
_footerBar = [[UIToolBar alloc] initWithFrame:footerFrame];
[self.view addSubview:_footerBar];
// add button(s) here..

立即亮点(好用户体验):

CGRect footerFrame = CGRectMake(...)
_footerBar = [[UIToolBar alloc] initWithFrame:footerFrame];
[self.view addSubview:_footerBar];
_footerBar.frame = footerFrame; // just assigning it again helps!
// add button(s) here..

- >毕竟不能可靠地工作。

IDEA 2:

UITableView子类并减少命中区域。

- >没工作

IDEA 3:

添加按钮作为viewController.view的子视图,而不是_footerBar

- >也没用。

IDEA 4:

尝试不同的UIButton类型。

- >没有帮助。

知道这里发生了什么吗?我想立即强调,但我希望它清洁和理解..

顺便说一下,我在这里谈论iOS7。

1 个答案:

答案 0 :(得分:0)

好的,案件结案。

问题是按钮的位置。它位于屏幕的底部。我假设iOS7等待判断水龙头是否实际上没有打开控制中心。

如果我将应用程序切换到全屏,则行为会有所不同,并且不会出现问题。