GOAT
GOAT

Reputation: 611

Access UI elements in UITableView section header

I created a header section for my UITableView following this post: https://stackoverflow.com/a/11396643/1568886. The issue I'm having now is accessing the buttons and label within the cell. When I connect the button and labels as outlets to the TableViewController Xcode throws an error:

/Users/ericky/Desktop/sample/sample-master/sample/en.lproj/MainStoryboard.storyboard: Couldn't compile connection: <IBCocoaTouchOutletConnection:0x7f8005e14430  <IBProxyObject: 0x7f8005e18260> => userProfileImage => <IBUIImageView: 0x7f8005e0d640>>

My view looks like:

enter image description here

How do I access the UI elements within the cell?

Upvotes: 0

Views: 720

Answers (1)

David L
David L

Reputation: 4429

You need to create a custom UITableViewCell, create a class for it and connect the buttons and labels to the class you created instead of the TableViewController. I used this tutorial to learn how to do it:

http://www.appcoda.com/customize-table-view-cells-for-uitableview/

Upvotes: 2

Related Questions