Disconnected view from View in interface builder iOS - xcode

I am working on my signInViewController.xib file and I accidentally disconnected the view from View in files owner. How do I fix this?

You mean you accidentally disconnected the view from the View Controller, yes?
If that's the case, control drag from the View Controller object to your view and one of the connections you can make is the View one.
If you actually mean that the File Owner for the XIB is no longer the View Controller, go to the Attributes Inspector for the File Owner and set the "Custom Class" attribute to the name of your View Controller class.
A nice visual description of the architecture is in this Apple documentation, in Figure 2-4.
Hope this info helps!

Related

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.

Return View From Controller in Area Not Working

After reading several posts on this subject I have yet to find an answer to my problem. I have an MVC 3 application and have added an Area to it. Everything works great until I try an return a view from a controller within the Area.
I can successfully post to the controllers Save Method but upon simply returning the view (return View()) I get the following:
The view 'Save' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Areas/Test/Views/Default1/Save.aspx
~/Areas/Test/Views/Default1/Save.ascx
~/Areas/Test/Views/Shared/Save.aspx
~/Areas/Test/Views/Shared/Save.ascx
...
This seems so basic, not sure why I am running into so much trouble.
Ive used Phil Haack's RouteDebugger (http://nuget.org/packages/routedebugger) and all routes are working as setup...
MVC is expecting (by the convention) a view (with the same name as your action name in any one of the folders (by default, But you can override this). You should have the view in any of the folders. That is the MVC convention. So add your view to that folder. You can add it by right clicking the Return View() statmenet in your action method and selecting Add View option. It will automatically add one view.
Or you can right click on the Areas/Test/Views/Default1 folder and select Add View and save it with the same name as of your Action method. If you want to save it with a differnt name than the action name, you can use the View method like this
return View("MyOtherViewName");
Assuming that you added a MyOtherViewName.cshtml as your View in the Areas/Test/Views/Default1 folder

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.)

Adding a UINavigationController built with IB

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.

Resources