2

I've looked through countless SO answers on this subject and cannot find what I am looking for.

I have a view I created in a xib file. It has a UITableView as a subview. I hooked up the delegate and data delegates to the controller and it works.

Now, I want to load a custom cell in the UITableView - the cell needs to have a UILabel a UITextField and three UIButtons that are only visible when a condition is met. My question is simply this:

Can I create a custom cell in a separate xib file with these elements that I need - the load it in the tableview and connect the UI elements to my viewController?

I've tried the above but IB does not allow me to make connections to my view controller.

Can anyone gov me some tips here?

Thanks!

iOS Dev
  • 4,143
  • 5
  • 30
  • 58
Robert J. Clegg
  • 7,231
  • 9
  • 47
  • 99
  • 1
    You can create a custom cell and add the required UI elements into it. It will work. You don't have to make the connection with the view controller, connections you have to make with the UItableViewCell subclass. – aToz Feb 04 '14 at 10:00
  • There are a lot of tutorials for google request "create custom uitableviewcell tutorial", just repeat or use source code. – kaspartus Feb 04 '14 at 10:01
  • 2
    Try this tutorial:- http://www.appcoda.com/customize-table-view-cells-for-uitableview/ – aToz Feb 04 '14 at 10:03
  • That's exactly what I was looking for. Nice find. Thank you @aToz – Robert J. Clegg Feb 04 '14 at 10:08
  • Great! I will add some tutorials as an answer to this question. – aToz Feb 06 '14 at 05:46

1 Answers1

2

For reference,

Custom TableViewCell tutorial 1

Custom TableViewCell tutorial 2

aToz
  • 2,463
  • 1
  • 24
  • 34