I have copied some files across from one project to another. The code simply displays a view you can scroll horizontally between items, and then scroll down each item.
The code was in a project with a MainWindow.xib and the relevant name in the plist file.
I’m putting the code into an empty OpenGL ES project which has no nib information in the plist file, and two nib files called “ProjectNameViewController_iPhone.xib” and “ProjectNameViewController_iPad.xib”
When I run the program, none of my code displays. I have a feeling the problem lies with where I am adding subviews to the view controller, and calling this line:
- (id)initWithPageNumber:(int)page
{
if (self = [super initWithNibName:@"MyView" bundle:nil])
{
pageNumber = page;
[self.view addSubview:newsItem];
}
return self;
}
First of all, It’s odd to me that the string here is “MyView” and not “MainWindow” as there is nothing in my project called “MyView” (I’ve searched the project directory and the code is being called)
but getting back to the point, the new code in the open GL ES project is this:
- (id)initWithPageNumber:(int)page
{
if (self = [super initWithNibName:@"IntegrationTestViewController_iPhone" bundle:nil])
{
pageNumber = page;
[self.view addSubview:newsItem];
}
return self;
}
I will put in a check later for Ipad users etc.. If the string is anything else, the code breaks when other parts try to access the classes view which doesn’t exist, but with this nothing displays.
what am I not understanding? (I’m quite new to ios / objective-c)
Check the outlets mad to ProjectNameViewController_iPhone.xib and File’s owner class.