UIButton的UIControlStateHighlighted仅适用于更长的分接头

时间:2014-04-14 12:34:06

标签: ios7

我为我的UIButton设置了titleColor和backgroundImage,如果我按下UIButton稍微长一点就行。但是对于非常快速的水龙头,这种变化是不可见的。是否有可能至少让它为这些类型的水龙头闪烁?

    [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
    [button setBackgroundImage:whiteBackgroundImage forState:UIControlStateNormal];
    [button setBackgroundImage:redBackgroundImage forState:UIControlStateSelected];
    [button setBackgroundImage:redBackgroundImage forState:UIControlStateHighlighted];

1 个答案:

答案 0 :(得分:2)

这是因为您向UITableView或UIScrollVIew添加了一个按钮。

对于UITableView中的按钮,将其添加到ViewDidLoad:

self.tableView.delaysContentTouches = NO;
for (id obj in self.tableView.subviews)
{
    if ([obj respondsToSelector:@selector(setDelaysContentTouches:)])
    {
        [obj setDelaysContentTouches:NO];
    }
}

对于UIScrollView中的按钮,请添加:

self.scrollView.delaysContentTouches = NO;
相关问题