objective c - UITableView within a UIView within UIViewController in iOs Xcode -


i want achieve following in xcode.

interface

i have view controller. within uiviewcontroller have uitabbar. below them uiview. best way add uitableview uiview? being able click on uitableviewcell , opening uiviewcontroller show more information uitableviewcell?

here current setup of storyboard:

current storyboard

could offer me solution problem? thanks

you need solution problem i'm not sure problem is.

in storyboard, drag uiview in uiviewcontroller. drag uitableview (not controller) in uiview.

you'll able see view hierarchy on left.

then link tableview datasource , delegate parent controller.

in .h file, add uitableviewdatasource , uitableviewdelegate protocols, link tableview outlet.

in .m files, add tableview delegate methods (numberofrowsinsection: , cellforrowatindexpath:)

i suggest adding didselect: among tableview methods because, well, you'll need it.

and you're go. :)

it's exact same thing creating tableview, except tableview subview of uiview, doesn't matter @ if comes code. thing you'll have "careful" of build view in storyboard, , make sure constraints don't make tableview unusable reason.

check one of previous answers explain how make tableview , make load controller while passing data, might need if wrote here still confuses you.

follow up:

from comments understand subview of uiview can different things ; tableview, webview, , on.

there many ways that, , little knowledge see 2 can easy , reliable (from <1year experience developer...).

  1. get possibilities ready in parent viewcontroller, if have 2 possibilities example, that's "okay".
  2. the best way prepare container view (it's literally called container view) load different other view controllers according needs.

i think option 2 more reliable, because split code different classes, allow modify each of them independently, , can remove/add new views.

to knowledge, you'll have kind of switch statement in parent controller load desired uiviewcontroller (or tableview or anything). whatever there usual, constricted smaller view inside vc.

you can create container view in storyboard , pre-link every other vc segues (totable, toweb, tocollection) examples segue names link container view 3 uiviewcontrollers.

note can pass data if need be, have separate controllers handle own stuff though visible inside current vc.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -