Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

StarLion

macrumors newbie
Original poster
Jan 3, 2011
12
0
(Yes, i'm a newb.)

I'm reading through/using as a reference SamsTeachYourself iPad Application Development.

I can create a SplitView, no problem.
I can create a MultiView, no problem.
I want to put my SplitView into the MultiView.
Tried to drag/drop the files (renaming them, of course), and that crashed the program on launch.
Tried to recreate the files in the Multiview app; that also causes the app to crash as soon as I click the button to produce the view.

The kill log comes up as:
Terminating app due to uncaught exception 'NSInternalInconsistancyException', reason: '- [UIViewController _loadViewFromNibNamed:bundle:] loaded the "InfoPanel" nib but the view outlet was not set.'

Any idea what i'm doing wrong or how to go about it easier?
 
A multiview (in Sams terminology, obviously), is a View Controller that loads other views.

Code:
@class CalcPanel;
@class InfoPanel;

@interface Multi2ViewController : UIViewController {
	IBOutlet CalcPanel *Calc;
	IBOutlet InfoPanel *Info;
}

@property (retain, nonatomic) CalcPanel *Calc;
@property (retain, nonatomic) InfoPanel *Info;

-(IBAction) loadCalc:(id)sender;
-(IBAction) loadInfo:(id)sender;

-(void) clearView;

@end

Code:
-(IBAction) loadCalc:(id)sender {
	[self clearView];
	[self.view insertSubview:Calc.view atIndex:0];
}

-(void) clearView {
	if(Calc.view.superview) {
		[Calc.view removeFromSuperview];
	} else {
		[Info.view removeFromSuperview];
	}
}
 
So i suppose the question is... how do I create a SplitView within this application, and load it using that coding? The InfoPanel.h and InfoPanel.m are only slight modifications of the standard Split View Based-Application template (and the modifications are only to establish the dataset, so nothing's been renamed or whatever), so the methods and such are already there and being built.

EDIT: Or i suppose more generally; I want part of my program to be displayed in a Split View, and part of it (say if the user pushes a button on the toolbar) to be displayed as a normal view would.
 
Last edited:
The error you quote is self-explanatory. It says that a nib was loaded but the view controller's "view" outlet wasn't set. UIViewController has an outlet named "view" and you must connect that outlet to a UIView in the nib that is loaded using initWithNibName:

There are several errors and misuse of naming conventions in the code you show, although it will probably mostly work. If that's directly from the book then you should probably look for another book. Also, Apple doesn't fully support third parties writing their own rootview controllers (unfortunately). There are some gotchas that will appear in many cases.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.