It’s almost the first time I’m implementing a table view in my code. I created a simple table view class and I did not use InterfaceBuilder for this part. I tried to use the method:
heightForRowAtIndexPath
I’m my class to changed the first row height size(in section 0) to 100 and for the rests it returns self.rowHeight;
I also created my tableviewcontroller(a subclass of tableViewController) to show my table view in a modal dialog. I tried to present it in a modal dialog, when it appears in modal dialog, the row height size of first section(when it’s suppose be 100) is NOT 100 .actually it is as the same size of other rows.
If I use to add the same tableview to another view in my app(not using modal dialog), it shows the first row height as 100. do you know what could be force the row height in modal dialog not to be as it set in the method heightForRowAtIndexPath?
Thanks,
Kamran
It sounds like you created a subclass of UITableView. So here’s a rule I learned a long time ago. If you’re subclassing UITableView or NSTableView, you’re probably doing something wrong. There is no magic here. UITableViewController is automatically setup to be the delegate and datasource for it’s tableview. And
heightForRowAtIndexPathis a delegate method. So it belongs in the delegate class. Read over the docs for UITableView and Objective-C programming regarding delegate methods. Also, http://dbrajkovic.wordpress.com/2011/03/10/delegate-methods-there-is-no-magic-cappuccino-cocoa/The point of delegate and datasource methods is to accomplish most customization of the tableview without having to subclass. If you’re setting delegate = self and datasource = self, you’re definitely doing something wrong. Even if you did HAVE to subclass UITableView, the delegate and datasource of the tableview should not be self.