用户在Thumb ViewController中单击拇指时如何显示自定义视图?

时间:2012-02-02 23:44:39

标签: iphone ios three20

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

- (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 :(我想禁用并仅显示此子视图。

1 个答案:

答案 0 :(得分:1)

这有助于我解决我的问题

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