开发者

UITableViewCell select even doesn't work

开发者 https://www.devze.com 2022-12-31 19:28 出处:网络
I had a page control(UIPageControl) on开发者_JAVA百科 a view (UIViewController) with table view (UITableView) on each page, each page have own table and can go to different view controller. i add the

I had a page control(UIPageControl) on开发者_JAVA百科 a view (UIViewController) with table view (UITableView) on each page, each page have own table and can go to different view controller. i add the codes in "didSelectRowAtIndexPath" which can go to next level, is works perfect when i test it in a table view by itself, but it doesn't works when i have page controller with it.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    if (pageNumber == 0) {

        PicturesViewController *picturesView = [[PicturesViewController alloc] init];
        [self.navigationController pushViewController:picturesView animated:YES];

        [picturesView release];

    } else if (pageNumber == 1) {

        PictureDetailViewController *pictureDetailView = [[PictureDetailViewController alloc] init];
        [self.navigationController pushViewController:pictureDetailView animated:YES];

        [pictureDetailView release];

    } else if (pageNumber == 2) {

        MessagesViewController *messagesView = [[MessagesViewController alloc] init];
        [self.navigationController pushViewController:messagesView animated:YES];

        [messagesView release];

    }

}

here is the code, if view directly to this table view this code is work,

how can i make it work under the pagecontrol??


I'm not entirely sure what you're asking but it looks like the "pageNumber" variable isn't the condition you are looking for.

Instead, try replacing the pageNumber == conditions with indexPath.row == 0, 1, 2 etc.


Use the parent view controller (with the page control) to push.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号