在UITableView的单元格上创建iOS 7风格的模糊

时间:2013-09-23 13:31:00

标签: uitableview ios7 blur gaussian

我已经能够通过使用这个库在UIView上创建一个模糊: https://github.com/nicklockwood/FXBlurView

这是非常好的和工作,我在UITableView上尝试过相同但它不起作用。 有没有人有其他想法?

编辑:

我能够使用FXBlurView,只需要玩图层

2 个答案:

答案 0 :(得分:2)

这是一个令人惊讶的优雅解决方案。使用UIToolBar会自动为背景视图(实时)带来模糊效果。只需将其设置为单元格的backgroundview

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

        // Do all your other stuff for setting up this cell.

        // Set the background view of the cell as UIToolbar for iOS 7 where it's translucent, picking up background view effect with blur.
        UIToolbar *translucentView = [[UIToolbar alloc] initWithFrame:CGRectZero];

        cell.backgroundView = translucentView;
        //[translucentView release]; // If you are using retain/release for memory management(non-ARC).
        return cell;
    }

答案 1 :(得分:1)

将FXBlurView设置为backgroundView的{​​{1}}属性。

tableView