learning much from you guys, and after a few hours I finally managed to load a xib into a GRect for a search xib that I built.
Basically, when you tap a cell in main.xib, it loads search.xib in a Grect so that I can filter down a list, click o nthe value, and place back into the cell in main.xib.
However I still have the cells from main.xib that overlay (tvcells) that overlay my search.xib.
Also it seems that none of the code is initializing for search.xib, I put an NSlog message in viewdidload in the search.xib, and nothing shows up in the console, letting me know that none of that code was executed.
Any idea why?
Thanks!
CGRect container = [[UIScreen mainScreen]bounds];
container.origin.x = 0;
container.origin.y = 0;
NSArray *views = [[NSBundle mainBundle] loadNibNamed: @"ingredientSearchViewController" owner: self options: nil];
UIView *referencedView = (UIView *)[views objectAtIndex:0];
referencedView.frame = container;
[self.subView addSubview:referencedView];
NSLog(@"loaded subview but obviously not in subview xib");
Additional code that attempts to do this as a controller
if (self != nil){
[self.view removeFromSuperview];
}
if(self == nil){
ingredientSearchViewController *vc = [[[ingredientSearchViewController alloc]initWithNibName:@"ingredientSearchViewController" bundle:nil] autorelease];
vc.view.frame = [UIScreen mainScreen].applicationFrame;
vc.delegate = self;
[self.subView addSubview:vc.view];
}
viewDidLoadis a method in NSViewController.And you are creating a View from Nib, therefore you should use the equivalent method
awakeFromNibfor NSView.