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

PrettyTableViewCell #48

Open
jayrparro opened this issue Oct 16, 2014 · 3 comments
Open

PrettyTableViewCell #48

jayrparro opened this issue Oct 16, 2014 · 3 comments

Comments

@jayrparro
Copy link

Xcode 6, iOS 8, using PrettyTableViewCell and the app is crashing related to KVO on line 481 -
any idea?

- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 
{
    if ([keyPath isEqualToString:@"frame"]) 
    {        
        UIView *contentView = (UIView *) object;
        CGRect originalFrame = contentView.frame;

        float shadowMargin = [self shadowMargin];

        float y = contentView_margin;
        switch (self.position) {
            case PrettyTableViewCellPositionTop:
            case PrettyTableViewCellPositionAlone:
                y += shadowMargin;
                break;
            default:
                break;
        }
        float diffY = y - originalFrame.origin.y;

        if (diffY != 0)
        {
            CGRect rect = CGRectMake(originalFrame.origin.x+shadowMargin,
                                     originalFrame.origin.y+diffY,
                                     originalFrame.size.width - shadowMargin*2,
                                     originalFrame.size.height- contentView_margin*2 - [PrettyTableViewCell neededHeightForPosition:self.position tableStyle:_tableViewStyle]);
            contentView.frame = rect; // --> crash here!
        }
    }
}
@henrikberg
Copy link

Found the same. It crashes due to recursion. If you test for (contentView.frame.origin.x != 0) and return, then the recursion is broken, but the size of the cells are wrong.
I have not debugged it more than that.

@ndressel
Copy link

Hi,

change UI elements in main queue:

dispatch_async(dispatch_get_main_queue(), ^{
            contentView.frame = rect;
        });

Greetz Nils

@Voidozzer
Copy link

Had the same problem. Thx to ndressel it is fixed now. App doesn't crash anymore but when using PrettyCell CPU usage is about 100%. Any ideas?

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

4 participants