RoundOutTooSoon
RoundOutTooSoon

Reputation: 9891

How to add an imageView on top of a tableViewController?

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.

Upvotes: 0

Views: 947

Answers (3)

Tyler
Tyler

Reputation: 28874

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.

Upvotes: 1

Ramin
Ramin

Reputation: 13433

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

Upvotes: 1

hatfinch
hatfinch

Reputation: 3095

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:.

Upvotes: 0

Related Questions