Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reuse view from storyboard

I have a tableview with custom section headers. The view for the section header is defined in the storyboard and wired to an instance variable. Is there a way to request a new instance of the view from the storyboard?

In the past I have done this by having the section header defined in its own xib file and getting a new instance by using

[[NSBundle mainBundle] loadNibNamed:@"TimerViewSectionHeader" owner:self options:nil];
UIView *newHeaderView = self.sectionHeaderView;
like image 298
railwayparade Avatar asked Dec 18 '11 23:12

railwayparade


People also ask

How do I connect storyboard to ViewController?

Create a new IBOutlet called shakeButton for your storyboard button in your ViewController. swift file. Select the shake button in Interface Builder. Then hold down the control button ( ⌃ ) and click-drag from the storyboard button into your ViewController.


1 Answers

I dont' think there is a way to do that. Best bet is to put the tableview custom header view in a separate nib and load it like you did in your code sample whenever you need to use it.

like image 53
agilityvision Avatar answered Sep 18 '22 00:09

agilityvision