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

stormbob

macrumors newbie
Original poster
Jun 7, 2008
27
0
Hello,
I am currently working on a Split View-Based Application where i have my UITableViewController which is a a subclass of the UIViewController class as the program provide as default.

My problem is as follow; is it possible to place a image above this UITableViewController? Displaying a image only visible when in landscape mode.

As seen below, i would like to place a image above the table:

table_view%20copy.png
 
Thanks for the answer, but that is one step ahead from where i am right now.
The problem i am currently having is getting the picture to display at all.

In my .h i've set up the UIImageView:
Code:
@interface RootViewController : UITableViewController {
    DetailViewController *detailViewController;
	NSArray *emner;
	IBOutlet UIImageView *topImage;
	
}

@property (nonatomic, retain) IBOutlet DetailViewController *detailViewController;
@property (nonatomic, retain) IBOutlet UIImageView *topImage;

And in my .h i have written the code below, and placed it into viewDidLoad.
However i do not get any picture at all. Anywhere.

Code:
	UIImage *image = [UIImage imageNamed:@"logo_top.png"];
	CGRect frame = CGRectMake(0, 0, image.size.width, image.size.height);
	topImage = [[UIImageView alloc] initWithFrame:frame];
	[self.view addSubview:topImage];
	[image release];

Any suggestions anyone?
 
You need a view hierarchy that has a container UIView with the imageView and tableView inside it. You need to use a UIViewController subclass instead of UITableViewController subclass. Make the container view the view controller's view property.

In the code you show you don't add the image to the imageView so of course you can't see it. But it wouldn't work anyway.
 
You need a view hierarchy that has a container UIView with the imageView and tableView inside it. You need to use a UIViewController subclass instead of UITableViewController subclass. Make the container view the view controller's view property.

In the code you show you don't add the image to the imageView so of course you can't see it. But it wouldn't work anyway.

Ok. Thanks for the answer.
I have tried what you explained but is currently a bit confused and unsure how i execute this, without having to redo everything i've made :).

Could you point me to a documentation of what i need to look into?
 
I don't have a specific document that I'd recommend except for the View Controller Programming Guide and the TableView Programming Guide from Apple. I don't know offhand of any apple samples that have a tableview and another view together, which is what you're trying to do. UITableViewController won't work in that configuration.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.