KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a UITableView which from an external RSS feed. When you select a row it uses navigationController and slides in from the right, the problem is that the RSS feed contains images therefore it can can take a few seconds to load and without any indication of what is going on you can mistake it for an application crash. I decided to add a spinner so that you know that new page is loading. Here is my code: RootViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Loading New Page"); [tableView deselectRowAtIndexPath:indexPath animated:YES]; DetailsViewController *detailViewController = [[DetailsViewController alloc] initWithNibName:@"DetailsViewController" bundle:nil]; detailViewController.item = [rssItems objectAtIndex:floor(indexPath.row/2)]; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; spinner.center = CGPointMake(160, 240); [self.view addSubview:spinner]; [spinner startAnimating]; [spinner release]; } DetailsViewController.m - (void)viewDidLoad { [super viewDidLoad]; NSString *imgURL = [item objectForKey:@"image"]; NSData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:imgURL]]; item_photo.image = [[UIImage alloc] initWithData:mydata]; item_title.text = [item objectForKey:@"title"]; item_date.text = [NSString stringWithFormat:@"Date: %@",[item objectForKey:@"date"]]; item_time.text = [NSString stringWithFormat:@"Time: %@",[item objectForKey:@"time"]]; item_cost.text = [NSString stringWithFormat:@"Cost: £%@",[item objectForKey:@"cost"]]; item_info.text = [item objectForKey:@"description"]; self.navigationItem.title = @"Event Type"; } </cod
Tags (comma-separated)
Save Edits
Cancel