How to load uiview by selecting row from uitableview
My app is a view based app and i added following components on it
Five uibuttons
On selecting any button drop down in the form of uitableview
So it has Five tableviews as well.
My problem 开发者_如何学Gois how to load detail view by selecting any row ,i didn't added navcontrllr and this is code for .....but this not working nthing happens on selecting row.
- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if([holidayData objectAtIndex:indexPath.row] == @"Sunday")
{
UIViewController *control = [[SundayController alloc] initWithNibName: @"MyViewController" bundle: nil];
UINavigationController *navControl = [[UINavigationController alloc] initWithRootViewController: control];
[self presentModalViewController: navControl animated: YES];
[control release];
}
[tv deselectRowAtIndexPath:indexPath animated:YES];
}
I think
if ([holidayData objectAtIndex:indexPath.row] == @"Sunday")
compares the pointers and not the actual strings. Have you tried using
if ([[holidayData objectAtIndex:indexPath.row] isEqualToString:@"Sunday"])
?
精彩评论