I implemented custom footer view, but unfortunately I can not scroll it to make all of it visible.
There is my code:
UIView *footerView = [[UIView alloc] init];
UIImageView *deliveryMainInfoImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)];
deliveryMainInfoImg.backgroundColor = [UIColor clearColor];
deliveryMainInfoImg.image = [UIImage imageNamed:@"delivery-cost.png"];
deliveryMainInfoImg.contentMode = UIViewContentModeScaleAspectFit;
[footerView addSubview:deliveryMainInfoImg];
CGFloat footerHeight = 0;
NSString *txt = @"Some long text here ...";
CGSize constraint = CGSizeMake(SCREEN_WIDTH - (3 * 10 + 100), SCREEN_HEIGHT);
CGSize labelSize = [txt sizeWithFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:SMALL_FONT_SIZE] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
footerHeight += labelSize.height;
UILabel *deliveryMainInfoText =[[UILabel alloc] initWithFrame:CGRectMake(deliveryMainInfoImg.frame.origin.x + deliveryMainInfoImg.frame.size.width + 10, 10, SCREEN_WIDTH - (3 * 10 + 100), labelSize.height)];
deliveryMainInfoText.backgroundColor = [UIColor clearColor];
deliveryMainInfoText.textAlignment = NSTextAlignmentLeft;
deliveryMainInfoText.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:SMALL_FONT_SIZE];
deliveryMainInfoText.textColor = [UIColor grayColor];
deliveryMainInfoText.lineBreakMode = NSLineBreakByWordWrapping;
deliveryMainInfoText.minimumScaleFactor = SMALL_FONT_SIZE;
deliveryMainInfoText.numberOfLines = 0;
deliveryMainInfoText.text = txt;
[footerView addSubview:deliveryMainInfoText];
UIImageView *deliveryExtraInfoImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, deliveryMainInfoText.frame.origin.y + deliveryMainInfoText.frame.size.height + 10, 100, 100)];
deliveryExtraInfoImg.backgroundColor = [UIColor clearColor];
deliveryExtraInfoImg.image = [UIImage imageNamed:@"delivery-info.png"];
deliveryExtraInfoImg.contentMode = UIViewContentModeScaleAspectFit;
[footerView addSubview:deliveryExtraInfoImg];
txt = @"Another long text ...";
labelSize = [txt sizeWithFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:SMALL_FONT_SIZE] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
footerHeight += labelSize.height;
UILabel *deliveryExtraInfoText =[[UILabel alloc] initWithFrame:CGRectMake(deliveryExtraInfoImg.frame.origin.x + deliveryExtraInfoImg.frame.size.width + 10, deliveryMainInfoText.frame.origin.y + deliveryMainInfoText.frame.size.height + 10, SCREEN_WIDTH - (3 * 10 + 100), labelSize.height)];
deliveryExtraInfoText.backgroundColor = [UIColor clearColor];
deliveryExtraInfoText.textAlignment = NSTextAlignmentLeft;
deliveryExtraInfoText.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:SMALL_FONT_SIZE];
deliveryExtraInfoText.textColor = [UIColor grayColor];
deliveryExtraInfoText.lineBreakMode = NSLineBreakByWordWrapping;
deliveryExtraInfoText.minimumScaleFactor = SMALL_FONT_SIZE;
deliveryExtraInfoText.numberOfLines = 0;
deliveryExtraInfoText.text = txt;
[footerView addSubview:deliveryExtraInfoText];
self.tableView.tableFooterView = footerView;
And after running code, as I expected there is footer as I need, but part of it is not visible and when I'm trying to scroll it table only bounces.
Please help to solve this issue.
Thanks for any advance!
You need to replace
UIView *footerView = [[UIView alloc] init];
with
UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
And set the width and height variables to the correct values depending on the size of the contents.