我已经用拇指(根据json数据)创建了TTThumbsViewController,当用户单击拇指时,我的应用必须在新的子视图中打开视频,如下所示:

- (void)thumbsViewController: (TTThumbsViewController*)controller
              didSelectPhoto: (id<TTPhoto>)photo
{
    NSMutableArray *photoset = [[NSMutableArray alloc] initWithArray:[self.photoSource photos]];
    Photo *selected = [photoset objectAtIndex:[photo index]];

    NSLog(@"%@", [selected urlLarge]);

    NSURL *url = [NSURL URLWithString:[selected urlLarge]];
    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackDidFinish:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:moviePlayer];

    if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
        moviePlayer.controlStyle = MPMovieControlStyleDefault;
        moviePlayer.shouldAutoplay = YES;
        [self.view addSubview:moviePlayer.view];
        [moviePlayer setFullscreen:YES animated:YES];
    } else {
        [moviePlayer play];
    }
}


NSLog显示该拇指已单击,但它打开了默认的TTPhotoViewController :(我想禁用并仅显示此子视图。

最佳答案

这可以帮助我解决问题

- (void)thumbsTableViewCell:(TTThumbsTableViewCell*)cell didSelectPhoto:(id<TTPhoto>)photo {
    [_delegate thumbsViewController:self didSelectPhoto:photo];
}

关于iphone - 当用户在Thumb ViewController中单击拇指时,如何显示自定义 View ?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9121761/

10-12 13:46