Adding a UINavigationController built with IB - xcode

Building an iPhone application. The delegate loads a SplashScreenView which sits there until the user taps the screen. When the user is done tapping the screen, I release that view and I want to load my custom Navigation Controller. I can't figure out how to load the Navigation Controller I designed in IB...it's currently loading a blank instance of UINavigationController.
I'm running this from my delegate:
mnc = [[MyNavigationController alloc] initWithNibName:#"MyNavigation" bundle:nil];
[self.window addSubview:mnc.view];
MyNavigation is a XIB I created which only has File's Owner/First Responder/a Navigation Controller I added. I set the class of File's Owner to MyNavigationController but I'm not sure how to tell it that I want the view "MyNavigationController" uses to be the one I designed. When I try to drag the "view" outlet of File's Owner in IB to my designed Navigation Controller, it doesn't seem to like it.
I'm just not sure how to connect the dots here. Any help would be incredibly appreciated.

What is the root controller of your navigation controller? The "blank" thing that you see is probably your navigation controller loaded with no controllers for it to navigate.
Update
You don't need "two controllers" per se. It's just that navigation controller is the one that controls the stack of other controllers you provide it with. First you init your navigation controller with root view controller (with initWithRootViewController method you mentioned), then you can push (pushViewController:animated:) or pop (popViewController:animated:) other controllers to or off of the stack of navigation controller.
Apple developer documentation provides plenty information in view controller programming guide on how different types of view controllers interact.

Related

Using container view with Xamarin and MVVMCross

I am trying to use a Container View within a View Controller (Free Form View) to reuse some components that are common for two views. So far I have a View Controller (Free Form View) with a Ui View and a Container View. Upon opening up the Free Form View, Container View should contain Free Form Purchase View, but when pressing the blue Button, that View should be replaced with the View last View Controller. I have a similar setup for Android where I use Fragments.
I am looking for the best way to navigate between the controllers. I use MVVMCross throughout the application, but I am open to other suggestions that does not involve MVVMCross.
you need to create your own controller which handles swapping of Views in Container View through custom Segue implementation.
You can find detailed step how to do this from Richard Woollcott post: Using the ContainerView to Transition between Views - aka More Fragments in Xamarin.iOS

Removing view from subview does not call willRemoveSubview

I have a managing view controller that switches in one of a set of previously allocated sub view controllers when the user chooses a menu item.
When I switch in a view controller I hook up the view of the managing view controller to the view in the sub view controller.
[mvc.view addSubview:subvc.view];
It all seems to work fine.
However, when removing that sub view controller's view from the view hierarchy with (eg.. when switching pages in the application):
[subvc.view removeFromSuperview];
the willRemoveSubview method in the custom view class never fires. I've confirmed that when I make the removeFromSuperview call I am calling it on an instance of my custom view class.
Other methods in my custom view class do fire though, such as viewWillMoveToWindow.
The NSView reference doc says this method should be called?
Can anyone suggest why this isn't working?
I'm running on 10.8.2 compiling for 10.7 with Xcode 4.5.2
Thanks
Darren.
willRemoveSubview:, as the name suggests, is called on the super view, not the subview being removed.

iOS5: Relationship Segues and Tabs without using UITabBar

TL:DR - How do I create Relationship Segues in Xcode 4.4?
Hello everyone, I have an app where I want to add some tabbing behaviour to one of my controllers but, due to design decisions, I can't use UITabbar. I already know about using a UIToolbar with a UISegmented control inside it, but where I'm having difficulty, is how to switch between view controllers.
I know I can't use normal segues (since each tab change would keep stacking a new controller on top of the previous), but UITabBar has something called "Relationship Segues". I looked around but couldn't figure out how to create one.
Does anyone know how do it? Also, is there a better way to approach this problem?
Thanks
I've done the exact same thing recently. I've created a container view controller, SegmentedViewController, and added the view controllers I wanted to switch between to my container controller using addChildViewController. Upon switching view controller (I used target/action on my UISegmentedControl), you call transitionFromViewController:toViewController:duration:options:animation:completion. That's the general idea. Look at the "Implementing a Container View Controller" section here for implementation details.

How to add a URL link using storyboard

I have created via Storyboard, a Navigation Controller connected to a Table View Controller where each table cell is linked to a different View Controller. One one of these View Controller I would like to put a URL, can I do this in Storyboard ?
Thank you.
You mean you want to click on one table cell so it takes you to a website directly outside of your app ? or to a web view inside your app ?
Since you're asking about a way to do this using Storyboard, I suggest putting a WebView inside your View Controller.

How do I make outlet connections from my view controller to my views?

Hi I'm trying to learn how to write apps for the iPhone.
I'm using a book to guide me. Unfortunately the book is written before interface builder was integrated in to Xcode.
So now I'm trying to make a simple app that switches between three views.
I want to connect an outlet from File's Owner to another view controller. In the book it says that I'm suppose to Control-drag from File's Owner to the view controller, in the Document window. But in the new Xcode there's only the iPhoneStoryboard and the Xib files for my other views/viewcontrollers. So how do you connect outlets between view controllers?
Could anybody please help me?
PS: the necessary code have already been written.
File's Owner is just a proxy for the object that's specified as the owner when the nib is loaded, usually either the application itself or a view controller. If you have a view controller in nib A that loads its view from nib B, then you can connect anything in nib B to the File's Owner proxy in B and it'll be connected to the view controller from A when the nib is loaded. Other than that, you can't connect objects in one nib to outlets in another. (It's possible to create other proxy objects like File's Owner, but if you were ready to do that you wouldn't be asking this question.)

Resources