Created
April 10, 2013 14:22
-
-
Save Lewuathe/5355065 to your computer and use it in GitHub Desktop.
Fighting with custom UITableViewCell ref: http://qiita.com/items/47f33f14a359b5c5d8fd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (id)initWithIndexPath:(NSIndexPath*)indexPath andVideoPlayer:(AVPlayer *)videoPlayer{ | |
| self = [super init]; | |
| if( self ) { | |
| AVPlayerLayer* layer = (AVPlayerLayer*)playerView.layer; | |
| layer.videoGravity = AVLayerVideoGravityResizeAspect; | |
| layer.player = videoPlayer; | |
| label.text = [NSString stringWithFormat:@"Movie %d",indexPath.row]; | |
| dispatch_queue_t q_global = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
| dispatch_queue_t q_main = dispatch_get_main_queue(); | |
| dispatch_async(q_global, ^{ | |
| dispatch_async(q_main, ^{ | |
| [self.contentView addSubview:playerView]; | |
| }); | |
| }); | |
| } | |
| return self; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment