Thank you, Alexey! I understand that Objective C may not be your language of choice, but while reading your post I couldn’t help but think “Alright, yeah! Artillery is coming”
I will be pleased to give you a quick tour of Storyboards. (I hope this is not considered off topic)
Storyboards is a fast way to layout your apps with little to no code. It gives you a visual editor where you can arrange your views and controls and iterate it very fast with the feedback of designers or clients.
For example, let’s build a prototype for your second project using storyboards.
In Xcode, we create a new project and choose Application > Single View Application. On the next dialog we check the option “Use Storyboards”. We will then see this
Storyboards are only available since iOS 5, so we make sure we target a recent version. The MainStoryboard will be launched when the application starts. If we take a look in the MainStoryboard.storyboard file, we’ll see that it already contains an empty ViewController that we can edit. The arrow in the left means this is the first ViewController that will be displayed.
If we select this ViewController and open the Identity Inspector, we’ll see that it is an instance of class ViewController (subclassed from UIViewController). This is the place where we can assign different classes to our objects.
So now let’s create another ViewController for our second scene. We just need to open the Object Library and drag a new UIViewController to the storyboard. We will have this
Now we change the color of the first view to blue to differentiate it and add a button to it from de Object Library. To make this button open the second ViewController we just need to right click on it (or ctrl-click) and drag to the second scene. It will ask what kind of Action Segue we want. We can choose Push. A final step is to embed everything inside a Navigation Controller, so we select the first ViewController and do
Editor > Embed In > Navigation Controller
Now he have this
And it should be working now. We can run it on the simulator to test it out. It’s a working prototype and we haven’t write a single line of code yet. So you can see how storyboards are useful. In fact, all the applications that I have seen this last few weeks (in other words, my entire Objective C career ) use this workflow.
To make the second scene display a web page, we just need a few more seconds of work. We create a new Objective C class, derived from UIViewController, name it WebViewController, for example, and define it as the class of our second ViewController in the Identity Inspector. Then we choose it’s inner view and make it derive UIWebView. Then we open the Assitant Editor to show simultaneously our storyboard and WebViewController.h. We drag from the view to the @interface and we create an outlet named webView.
A bit of code now, in the WebViewController.m we put this inside viewDidLoad
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://unity3d.com"]];
[self.webView loadRequest:request];
And our prototype is almost done! We only need to fill that blue view in the first scene with our Unity content. Unfortunately I have no idea how that can be done. So that’s where your help will be immensely useful
Here’s hoping it can be done
Cheers!