objective c - Getting the header view height of a section -
i've implemented
- (void)tableview:(uitableview *)tableview willdisplayheaderview:(uiview *)view forsection:(nsinteger)section delegate method , within implement piece of code
uitableviewheaderfooterview *header = [[uitableviewheaderfooterview alloc] initwithreuseidentifier:@"paymentformheader"]; header = (uitableviewheaderfooterview *)view; then try , assign uiview header with
uiview *header = [self.tableview dequeuereusableheaderfooterviewwithidentifier:@"paymentformheader"]; and null value in return. first time using method i'm not understanding correctly , noticed didn't ask indexpath. appreciated. thanks.
there few issues here. first you're not using right method set header. method you're using (..willdisplayheaderview..) there let know when header you've set displayed can additional setup or tracking after point.
you want implement 2 methods working:
- (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section and
- (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section your next issue how trying dequeue view. either need check nonexistent dequeued view , initialize 1 manually reuse identifier, or register appropriate class in advance. recommend registering in advance. fix this, in viewdidload or @ point after uitableview has been initialized, register class this:
[mytableview registerclass:[uitableviewheaderfooterview class] forheaderfooterviewreuseidentifier:@"paymentformheader"]; that make sure valid initialized view of type reuse identifier when try dequeue it.
Comments
Post a Comment