I've created a UITableView
in Interface Builder using storyboards
. The UITableView
is setup with static cells
and a number of different sections.
The issue I'm having is that I'm trying to setup my app in several different languages. To do this I need to be able to change the UITableView
section titles somehow.
Please can someone help me out? Ideally I'd like to approach the issue using IBOutlets
however I suspect this isn't even possible in this case. Any advice and suggestions would be really appreciated.
Thanks in advance.
section label text are set.
titleForHeaderInSection is a delegate method of UITableView so to apply header text of section write as follows,
(original)
I had a similar requirement. I had a static table with static cells in my Main.storyboard(Base). To localize section titles using .string files e.g. Main.strings(German) just select the section in storyboard and note the Object ID
Afterwards go to your string file, in my case Main.strings(German) and insert the translation like:
Additional Resources:
Use the UITableViewDataSource method
Once you have connected your UITableView
delegate
anddatasource
to your controller, you could do something like this:ObjC
Swift
Note that
-(NSString *)tableView: titleForHeaderInSection:
is not called by UITableView if- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
is implemented in delegate of UITableView;