getting data from tableviewcell to 2nd view

Posted by chubsta on Stack Overflow See other posts from Stack Overflow or by chubsta
Published on 2010-04-10T10:38:03Z Indexed on 2010/04/10 10:43 UTC
Read the original article Hit count: 288

I am very new to this and am trying to learn by creating a few little apps for myself. I have a navigation-based app where the user taps the row to select a film title - i then want the second view to show details of the film.

Thanks to a very helpful person here i am getting the results of the row pressed as 'rowTitle' as follows :

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *key = [keys objectAtIndex:indexPath.section]; NSArray *nameSection = [names objectForKey:key]; NSString *rowTitle = [nameSection objectAtIndex:indexPath.row]; NSLog(@"rowTitle = %@", rowTitle); [tableView deselectRowAtIndexPath:indexPath animated:YES];

I am, however, struggling to make the data at 'rowTitle' available to the 2nd view -

basically, if i can get the info - for example rowTitle is "aliens2" - i want to be able to add a new extension to the end of the string returned by 'rowTitle' in order to point to an image (if that makes sense) in the second view...

something like

tempImageName=[** this is where the info from rowTitle needs to be i suppose**]; tempImageType=@".png"; finalImageName=[tempImageName stringByAppendingString:tempImageType];

does this make sense to anyone (apologies if it doesnt - i know what i want but how to explain it is a little more awkward!)

Thanks again for any help anyone can give (and any help as to formatting these questions would be useful too obviously!!)!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitableview