Problem with placing a image in a Split View-Based Application

Discussion in 'iOS Programming' started by stormbob, Feb 16, 2011.

  1. stormbob macrumors newbie

    Jun 7, 2008
    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:

  2. nickculbertson macrumors regular


    Nov 19, 2010
    Nashville, TN
    Check out this video and the two that follow "The New Boston Orientation."


  3. stormbob thread starter macrumors newbie

    Jun 7, 2008
    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:
    @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.

    	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?
  4. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    By creating a new UIImageView, you're wiping out the one you've set up in IB. Just try setting the image of the existing one.
  5. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    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.
  6. stormbob thread starter macrumors newbie

    Jun 7, 2008
    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?
  7. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    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.

Share This Page