views:

253

answers:

3

I have a ViewController consists of a ImageView on top at (0, 0, 320, 100). I need to have a tableViewController below it, say from (0, 100, 320, 380).

How do I do that? please help I tried many methods but it didn't work out. I need your help.

A: 

What you probably want is a single view controller whose view contains more than one view. You should probably make your single view controller a UITableViewController and then add the UIImageView to its view in -viewDidLoad:.

hatfinch
+1  A: 

Apply the answer to this question but instead of a textfield use an imageview.

Ramin
+1  A: 

In general, you usually don't want to have more than one view controller in charge at a time. The exceptions are tab bar or navigation controllers, which are basically containers for other controllers.

So, as Ramin has linked to, the way to do this would be to have one view controller in charge of the entire screen, with your UIImageView positioned where you like it, and add a UITableView on another part of the screen - both as subviews of your view controller's root view (referred to as self.view within the controller).

You get essentially all the functionality of a table in UITableView without any need for a UITableViewController.

Tyler