How to disable scrolling in a Table View
self.tableView.scrollEnabled = NO;
Add this to any method that references your table view, such as
tableView:numberOfSectionsInTableView
tableView:numberOfRowsInSection
tableView:cellForRowAtIndexPath
self.tableView.scrollEnabled = NO;
Add this to any method that references your table view, such as
tableView:numberOfSectionsInTableView
tableView:numberOfRowsInSection
tableView:cellForRowAtIndexPath
The UITableView implements a header and a footer when you’re using the tableView:titleForHeaderInSection method (tableView:titleForFooterInSection respectively). However when the header (or the footer) is displayed you can’t change the font or colour of your text. You can however implement the following methods in your table view delegate and create a custom UILabel object for the […]
Each table view cell has an accessory type on the right. You can check which one should be shown by default in Interface Builder (those are none, tick box (aka checkmark), disclosure and detail disclosure chevrons). You can however use your own graphics in this place. All we need to do is add our own […]
The easiest way to do this is by adding a UIImage to your table. Rather than instantiating a new table object you can simply add the following line into the first Table View Data Source method you have – such as this one: – (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { tableView.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@”background.jpg”]]; // Return the […]
An alert view has the clickedButtonAtIndex property. The first clicked button is 0, the next one 1, and so forth. If you conform to the UIAlertViewDelegate protocol you can implement the following method and react to each pressed button accordingly, or…
If you’re conforming to the UIWebViewDelegate protocol the webView:didFailLoadWithError: method gets triggered when there has been a problem. Call it like this and display an error message (in this case a UIAlertView): This method is also a good opportunity to stop any loading animations you’ve got going.
Here’s how you start it: UIApplication *application = [UIApplication sharedApplication]; application.networkActivityIndicatorVisible = YES; And this is how you stop it: UIApplication *application = [UIApplication sharedApplication]; application.networkActivityIndicatorVisible = YES; Comes in handy when displaying a UIWebView or performing any other activity that requires the user to “hang in there for a bit”. If you want to […]
Say you have a central array somewhere and would like display this in more detail via two table view controllers. Instead of passing only the relevant information, you want to pass the entire index path from table1 to table2 and beyond. You can pass data in the prepareForSegue:sender method and let the Storyboard to the […]