Issue:
Use prototype UITableViewCells from Storyboard for use as header and footer of section. I want to use them from storyboard because of Autolayout feature.
For footer, i need to have centered UIActivityIndicator. For header there will be something else.
What i have tried:
Inside the Storyboard, i have created UIViewController. Inside this UIViewController is UITableView and UIView with UIActivityIndicatorView.
I have tried to deep copy like in this Question . But it doesnt work. UIView doesnt implemet NSCopying protocol.
Is there a way to instantiate header and footer views from storyboards?
UPDATE
Found out UITableViewHeaderFooterView
but after reading docs i dont see a way to create prototype cells in storyboard.
Created cell prototype in storyboard.
In view controller, in - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
got the cell by dequeReusableCellWithIdentifier
with id of that prototype.
From method call, return not table view cell, but it's content view.
This works but is not really nice solution. But it beats manually typing cell code and attaching auto layout rules any day. Didn't notice any abnormal behavior during testing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.