UITableViewController (uitvc) template updated for UITableViewSource
Monday, November 2, 2009 at 2:33PM MonoTouch 1.2 adds a new class called UITableViewSource that is intended to reduce some of the code clutter that is encountered when using TableViews in MonoTouch. The UITableViewSource class combines UITableViewDelegate and UITableViewDataSource into one convenient class that contains the methods of both. This results in a much closer approximation of the way the UIKit classes work. In UIKit you would typically have your TableViewController implement the protocols for delegate and datasource and thus all of your methods from these two protocols would be in the same class. The UITableViewSource class gives you a similar code structure.
I have modified the uitvc template for generating a UITableViewController that uses this new UITableViewSource class. Create an Empty class file from the File->New File…->General menu. Delete everything in this class file. Type uitvc and hit the tab key. This will create a UITableViewController subclass that sets up a UITableViewSource as its Source. All you need to do is specify the namespace for the controller, the name for your class, the shorthand that will be used to reference the instance of the controller in the UITableViewSource, and the Title for the controller. I have provided a few overrides that will get you started after that. You can download the template here: uitvc.template.xml
You will need to add this to ~/.config/MonoDevelop/templates/code (choose “Go to folder…” from the Finder menu and paste the directory to find it) and restart MonoDevelop. (Note: If you don’t see templates/code in ~/.config/MonoDevelop, go to Preferences in MonoDevelop and click on Code Templates under Coding. This should populate this directory. You don’t need to do anything else here, just close Preferences and follow the instructions above to add the file to the ~/.config/MonoDevelop/templates/code directory.)
Reader Comments (7)
Thanks Brent, these templates are really useful.
No prob Alex! I figured it was about time to update it since the UITableViewSource thing is pretty awesome.
Thanks Brent, didn't know about these templates in monodevelop.
Thank you thank you!!!!
Would anymore be coming? This is AMAZINGLY helpful.
Just so you know. The link should be "http://www.codesnack.com/storage/templates" that way the user can copy the file instead of the code in the file which is of no help.
Great job! and Thank you
Adan
I like your site. It’s really simple and cool without no much of put ups. I am also going to design my site simple and nice as yours
Cheap Dental Health Insurance
Full Coverage Dental Insurance
Benefits of Affordable Dental Insurance
Im not that much of a reader to be honest but your blogs pretty good, keep it up as I will bookmark ready for my next read
Small Corner Computer Desk
Portable Air Conditioning Unit
double oven electric range
Cheap Life Assurance Quote
Dolce and Gabbana Sunglasses
Disney Minnie Mouse
microwave rice cooker
jazz music download
asbestos attorney cancer lawyer mesothelioma settlement
Business week MBA
Products Review and Price
Hair Loss Solutions
Health and Fitness
Female Hair Transplant
The Truth About Six Pack Abs Review
Cheap Dental Health Insurance
Email Database
Hot News and Events
Fish Finder
Make Up Brushes