Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios 8: custom subviews of cell get offset twice. #23

Open
Maxtws opened this issue Oct 2, 2014 · 0 comments
Open

ios 8: custom subviews of cell get offset twice. #23

Maxtws opened this issue Oct 2, 2014 · 0 comments

Comments

@Maxtws
Copy link

Maxtws commented Oct 2, 2014

If you try to add a custom element (any view) to your cell's view in IOS8 you'll see that they get away from screen very fast while swiping and they never get back. This is caused by redundant offset modification to the subviews of UITableViewCellContentView after UITableViewCellContentView's offset is modified.
In the SWRevealTableViewCell.m : - (void)_setRevealLocation:(CGFloat)xLocation


    for ( UIView *view in _revealLayoutView.subviews )
    {
        // One of the contentView's siblings of is the cell's separatorView.
        // We do not want to apply our custom layout to that particular view, so we skip that view based on its class name.
        // This is of course hacky and may break in the future. However since we choose to apply our layout directly to the cell, as oposed to
        // the cell's contentView we do not have other choice than filtering this here.
        // If this code breaks on a future iOS release it will be very easy to fix anyway.
        {
            if ( [NSStringFromClass([view class]) rangeOfString:@"Separator"].length > 0 )
                continue;
        }

        view.frame = CGRectOffset(view.frame, xLocation, 0 );
    }
}

I suppose the only views which frames need to be modified here are SWUtilityContentView and UITableViewCellContentView.
However, if you add your subviews to cell.contentView everything works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant