Look this situation...
My View disappears.
Why ???
http://www.4shared.com/photo/9XIMsP9a/AppConcDuvida.html
Creating DetalhesViewController in code is unlikely to work correctly.
If you're going to use a storyboard and segues, then you should be making your connections there and configuring the new controller in prepareForSegue instead of didSelectRowAtIndexPath.
You should instantiate your view controller from storyboard.
DetalhesViewController *detailViewController = [self.storyBoard instantiateViewControllerWithIdentifier:#"controllerIdentifier"];
self.navigationController push:detailViewController animated:YES];
Related
I have a popover menulet and it's contentViewController is some NSViewController. Everything fine here. The problem that I have is that I really don't understand how to change the View. I wanna load another view, and this is what I tried:
popover = [[NextViewController alloc]initWithNibName:#"NextViewController" bundle:nil];
[self.view addSubview:[popover view]];
And this works, new view is shown - but if I click on any button on that view I get error: unrecognized selector sent to instance. Why am I getting this error? Why this new view is not responding?
Please help me understand what I need to do, how to change the view on NSPopover?
I've managed to solve my problem, It turn out to be quite easy:
[self.view setSubviews:[NSArray array]]; //remove all previous subviews
[self.view addSubview:[popover view]];
Hy,
so i have a question about adding a subview. I'm just created an iPad app which has a home screen i which i should add a subview at some point . But when i use :
NotesMainViewController *openNotes = [[NotesMainViewController alloc]initWithNibName:#"NotesMainViewController" bundle:nil];
[self.view addSubview:openNotes.view];
the main view imports that another view, but the controls on it like UITextField or anything else don't work. So, can please anybody tell me how can I add a view from ViewController to a another view (in that case homeViewController). I have been trying with the addsubview method but it doesn't work.
Please excuse my ignorance, I'm coming from iOS to Mac programming. I have two nibs. One is the main window with the split view. The nib contains a navigationController view I created. I'm trying to replace the right pane of the split view (navigationView) with this view. When the application first launches, navigationView is just a custom view in interface builder.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NavigationController *navController = [[NavigationController alloc]
initWithNibName:#"NavigationController"
bundle:[NSBundle mainBundle]];
navigationView = navController.view;
}
This doesn't seem to do anything. I tried adding the navController.view as a subview, and that at least gets it showing up, but it is placed very oddly. Any suggestions? Thanks!
You will definitely have to add the views you want in the NSSplitView as a subviews of the NSSplitView. You'll need to provide more information about what happens after that.
There's lots of sample code on Apple's website and many of them use NSSplitViews.
If I already have a UIViewController(no nib) on iphone,and I wanna use it on ipad.
I use a IBOutlet(UIView)on ipad to show this view.
I try to set in viewDidLoad :
MacroMainView *marcoview =[[MacroMainView alloc]initWithNibName:nil bundle:nil];
marcoView =[marcoview view];
[[self view]addSubview:marcoView];
but still no work..
What should I do??
Thanks in advance.
You should use loadView method for a UIViewController without a nib. UIViewController Doc
If you create your views manually, you must override this method and use it to create your views
I am passed a NSView from a class and I need to add on another NSView at a certain point. How do I do that?
Thanks in advance.
You can add a view to another view by sending the addSubview message, like this:
[MyView addSubview:MyOtherView];
Don't forget though, you are responsible for how that view displays. Make sure you set its bounds.
You can position the new view when instantiating it using the initWithFrame: method that'll create the view and position it within the superview (i.e. the one you'll add your view to with the already mentioned addSubview: message).
PS: The View Programming Guide - is your friend.. ;-)