Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

QSection footer height is always 28.0 when it's set to a string #32

Closed
karlozm opened this Issue · 2 comments

2 participants

@karlozm

Problem
When setting the section footer using a string its height is always 28 regardless of its length

Proposed code solution
I'm not pushing my copy of the code, i'm assuming you might want to use your own coding standards and because i don't know if you want to delegate this task to the user or directly integrate it.

This code will calculate the height for the footer.

QuickDialogTableDelegate.m (tableView:heightForFooterInSection:)

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)index {
    QSection *section = [_tableView.root getSectionForIndex:index];
    CGFloat stringFooterHeight = 28.0;

    if (section.footerView!=nil)
            return section.footerView.frame.size.height;

    if (section.footer != nil) {
        CGFloat maxWidth = [UIScreen mainScreen].bounds.size.width - 50;
        CGFloat maxHeight = 9999;
        CGSize maximumLabelSize = CGSizeMake(maxWidth,maxHeight);
        CGSize expectedLabelSize = [section.footer sizeWithFont:[UIFont systemFontOfSize:[UIFont labelFontSize]]
                                              constrainedToSize:maximumLabelSize
                                                  lineBreakMode:UILineBreakModeWordWrap];

        stringFooterHeight = expectedLabelSize.height;
    }

    return section.footer != NULL? stringFooterHeight : 0;
}
@escoz
Owner
@escoz
Owner

Thanks for the help! I ended up committing exactly what you suggested, just included a simple test case.

@escoz escoz closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.