hi,
i am new to iphone programming and working now on a simple app.
i have a plist which has multiple array and each array with multiple items (numbers). loaded and connected perfectly to the tableview.
the problem is whenever i click in a row to get the AlertView msg to show only the selected row it loads all the rows at once with parentheses at the beginning and at the end of the list . (look at the pic).
this is the code used to load from the plist.
here is the alertview code:
i think the problem is in this piece of code but i don't know what>
this is what happen when i click the row:
pls help.
i am new to iphone programming and working now on a simple app.
i have a plist which has multiple array and each array with multiple items (numbers). loaded and connected perfectly to the tableview.
the problem is whenever i click in a row to get the AlertView msg to show only the selected row it loads all the rows at once with parentheses at the beginning and at the end of the list . (look at the pic).
this is the code used to load from the plist.
Code:
-(void) viewDidLoad {
NSString *path = [[NSBundle mainBundle] pathForResource:@"hilton" ofType:@"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
self.names = dict;
[dict release];
NSArray *arrray = [[names allKeys] sortedArrayUsingSelector:@selector(compare:)];
self.keys = arrray;
}
here is the alertview code:
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSUInteger row = [indexPath row];
NSString *key = [keys objectAtIndex: row];
NSString *rowValue = [names objectForKey:key];
NSString *addresss = [[NSString alloc] initWithFormat:@"%@", key];
NSString *title = [[NSString alloc] initWithFormat:@"%@", rowValue];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:addresss message:title delegate:nil cancelButtonTitle:@"yes" otherButtonTitles:nil];
[alert show];
[alert release];
[title release];
}
i think the problem is in this piece of code but i don't know what>
Code:
NSUInteger row = [indexPath row];
NSString *key = [keys objectAtIndex: row];
NSString *rowValue = [names objectForKey:key];
this is what happen when i click the row:

pls help.