I have a storyboard TableView with a Custom storyboard TableViewContoller class. I'd like to add an icon to the header of the TableView, but am having a hard time trying to figure out how to do it. I don't see the header in my TableViewController in the storyboard, and ran across a Stack post which said to just drag the UIImageView to the top of the prototype cells but this doesn't seem to work quite right.
I then got an IBOutlet hooked up to the storyboard UIImageView and populate that property from viewDidLoad in my TableViewController custom class:
@property (weak, nonatomic) IBOutlet UIImageView *mImagePic;
...
- (void)viewDidLoad
{
UIImage *pic = _mPersonPhoto;
[_mImagePic setImage:pic];
...
}
This sort of works, but the image ends up in the first tableview row and I want it in the Header so it doesn't disappear under the header when scrolling the list. So, then I tried this:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIImage *pic = _personPhoto;
[_mImagePic setImage:pic];
return (_mImagePic);
}
The second code snip does about the same thing as the first, but the pic is still not in the header (screenshot above). It's made the first row higher, but that's about it. I guess the next try is to create the entire header from code in viewForHeaderInSection
but that seems to make storyboarding pointless. How can I get the picture in the Header without having to rebuild the whole Header (adding back button, title, etc)?