I am doing iOS
project with storyboards in MonoTouch
.
I have the custom class of UITableView (myCustomTableFoo
) and specified the prototype cells of this class in IB. Then I want to instance this class programmatically. The bad thing it's lacking the prototype cells, and I don't know how to insert that prototype cells to my programmatically created table object.
I have a storyboard and I want to use my prototype cells from IB
in all my inherited table classes. I think MonoTouch
could be pretty similar to Objective-c in this case.
You could use
then you can dequeue your cell using
the cell would be automatically instantiated. You do need to register your class using
[Register("MyCell")
and it should have a constructor likeOne thing though, I don't think you can reuse the cell you defined in your storyboard. If you want to reuse the same cells in different TableView instance, you can create a unique Nib for your cell and then something like that would do the trick:
Here I'm using a generic view defined on an external Nib. I manually instantiate it when feeding the data into the Cell if it doesn't has been yet instantiated. It happens typically at the first time the Cell was instantiated.