Create Custom Cell Using XIB With Protocol(Call back method)
I will show you how to customize table view cells by using static xib and by subclassing UITableViewCell.
Set up the rest as in the picture below and click Next (I put project name CellProject)
The next step is to create a custom UITableViewCell. Right-click your project name node in the Project Navigation view and choose ->New File ->Cocoa Touch Class.
Set Class for you cell (I put here CustomTableViewCell) and must be subclass to UITaleViewCell and conform check Also create XIB file option.
And also I create protocol for button action it gave me callback on my view when I click any button.


Be sure to have Outlet type of the connection selected. Name the property valueField
We are going to create a value object based on NSObject class for hold data. In my case I am using User model.
Now, In ViewController class and stroyboard and I add all the necessary like, tableview add table view delegate and custom cell delegate. And add a dummy data method. and run the app
And finally you got this :)














No comments:
Post a Comment