» about » content » twitter » github »

Sending a string value to the FlipsideViewController in a Utility iOS Application

The first bit of advice I have here (as it took me hours to figure this stupid piece out) is that you have to create an application using the utility application template but you need to choose NOT to create a storyboard for this (all the examples for this that I found anywhere neglected to point this part out - I suspect that in the earlier days of xCode that there was only the non-storyboard option).

This is the page that finally snapped me out of my developer-death-spiral.

Here in short is the solution...

in the MainViewController.h under showInfo you need to only add the following line after controller.delegate : self;:

controller.labelText = @"Hi";
    

in FlipsideViewController.h add the following:

@property (nonatomic, copy) NSString *labelText;
    

on the FlipsideViewController.xib add a label and create its outlet (simply called label in this example)

under viewDidLoad add the following:

// Do any additional setup after loading the view, typically from a nib.
[self.label setText:self.labelText];
    

That's it.

© Roqet 2018 :: 2018-05-11 17:07:11