我得到了你的问题的解决方案......所以,你可以使用这个:`
[yourButton setBackgroundImage:[self getVideoThumbnail:urlFromVideo]
forState:UIControlStateNormal];
[yourButton setImage:[UIImage imageNamed:yourImageName] forState:UIControlStateNormal];`
getThumbnail 的函数在这里:
- (UIImage *)getVideoThumbnail:(NSURL *)videoURL
{
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
//Player autoplays audio on init
[player stop];
return thumbnail;
}
我认为这是您的选择...