Tag Archives: uitableview

Labels aligning in UITableViewCell

Questions: I use UITableView with cells created using UITableViewCellStyleSubtitle. Every cell’s height is dynamically adjusted using the – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath delegate method. The problem you can see on the picture (note: image updated) http://img.skitch.com/20090715-g7srxgee2d7fhi5rab2wufrdgm.png How to set up align of textLabel and detailTextLabel to the top of the cell? (I really don’t wont… Read More »

How to stop UITableView from loading until data has been fetched?

Questions: I understand that UITableView will call -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method to get each of the cells for the table view. Say I have my data source is fetched over the internet and I have to account for latency. What will be the best way of “stopping” this method from being called? Should… Read More »

UITableView header/footer font color

Questions: When overriding the header/footer of a (group styled) table view, what colour should be used for the header and footer fonts to ensure the header and footer fonts are consistent with the standard header and footer fonts? ie The header is being loaded like this: – (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if(myHeaderView == nil)… Read More »

Dynamic UITableView Cell Height Based on Contents

Questions: I have a UITableView that is populated with custom cells (inherited from UITableViewCell), each cell contains a UIWebView that is automatically resize based on it’s contents. Here’s the thing, how can I change the height of the UITableView cells based on their content (variable webView). The solution must be dynamic since the HTML used… Read More »

adding images to UItableView

Questions: Is it possible to add images to a table view? To the left side? And if so, what size should it be? Answers: A custom UITableViewCell is not required to simply add an image to the left side of the cell. Simply configure the imageView property of the UITableView cell in your tableView:cellForRowAtIndexPath: delegate… Read More »

Design UITableView's section header in Interface Builder

Questions: I have a xib file with a UITableView for which I want to add a custom section header view using the delegate method tableView:viewForHeaderInSection:. Is there any possibility to design it in Interface Builder and then change some of it’s subview’s properties programmatically? My UITableView has more section headers so creating one UIView in… Read More »

UITableView scrollToRowAtIndexPath

Questions: I’m trying to make my table view remember it’s last position, so that after the app is run again, it will scroll to that position. to do this, in my viewWillDisappear: method, I get the first visible row number and save it to NSUserDefaults. then in my viewDidAppear I try to scroll to that… Read More »

Automatic scroll to top doesn't work in UITableView

Questions: usually when tapping the top of the screen the tableview scrolls all the way to the top. For some reason this doesn’t work in one of my view controllers. The hirarchy is as follows: UIView -> WebView -> TableView —–>SearchBar SearchDisplayController. I think I have everything hooked up correctly (datasource, delegate, …). I have… Read More »

Changing the color of UITableView section headers

Questions: OK, I know that this has been asked previously, so please forgive me for asking again. It just seems like there has got to be an easier way to do this. Is there a ‘simple’ way to change the UITableView section header background color? I know that I can use the delegate method ‘viewForHeaderInSection’… Read More »