Fedya Skitsko
Fedya Skitsko

Reputation: 337

How to show custom view when user click on thumb in TTThumbsViewController?

I have created TTThumbsViewController with thumbs (from json data) and when user clicks on thumb, my app must open video in new subview like this:

- (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 shows that thumb clicked but it open default TTPhotoViewController :( I want to disable and show only this subview.

Upvotes: 0

Views: 198

Answers (1)

Fedya Skitsko
Fedya Skitsko

Reputation: 337

This helps me and solve my problem

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

Upvotes: 1

Related Questions