यह मिला।
एक ही समस्या थी - यहां मैंने जो किया है। मैं यह सुझाव दूंगा कि यह आपके काम में एक-एक करके कोड को जोड़ने का सुझाव देगा कि यह कैसे काम करता है।
पहला - मैंने चीजें पोर्ट्रेट मोड रखी हैं।
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
तब मैंने फिल्म को स्टेटस बार पर ले जाया।नोट - यह मान लिया गया वीडियो फिर एक 4x3 पहलू अनुपात
theVideo = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath : path]];
float aspectRatio = (3.0f/4.0f);
float theMovieHeight = [self view].bounds.size.width * aspectRatio;
[[theVideo view] setFrame:(CGRectMake(0, [self view].bounds.size.height - theMovieHeight, [self view].bounds.size.width, theMovieHeight))];
है, वह जगह है जहां आवेदन शुरू होता है में (मेरी परियोजना में, यह didFinishLaunchingWithOptions
समारोह में है) - वैसे भी, तुम बस के लिए उपयोग की जरूरत है खिड़की वस्तु।
float aspectRatio = (3.0f/4.0f);
float theMovieHeight = self.window.bounds.size.width * aspectRatio;
float theSpaceAboveTheMovie = self.window.bounds.size.height - theMovieHeight;
float whereTheMovieShouldBeCentered = (self.window.bounds.size.height - theMovieHeight)/2;
CGAffineTransform theTransform = CGAffineTransformMakeTranslation(0,0);
theTransform = CGAffineTransformScale(theTransform, 1.0f/aspectRatio, 1.0f/aspectRatio);
theTransform = CGAffineTransformTranslate(theTransform, -whereTheMovieShouldBeCentered, 0);
theTransform = CGAffineTransformRotate(theTransform, M_PI/2);
theTransform = CGAffineTransformTranslate(theTransform, 0, -theSpaceAboveTheMovie);
[self.window setTransform:theTransform];
याद रखें कि एफ़िन ट्रांसफॉर्म रिवर्स ऑर्डर में किए जाते हैं। तो अगर आप प्रत्येक क्या बदलना है (मैं सुझाव है कि आप चाहिए) कर देखना चाहते हैं, पहले तीन
यहाँ आप फिल्म और स्थिति पट्टी
// theTransform = CGAffineTransformScale(theTransform, 1.0f/aspectRatio, 1.0f/aspectRatio);
// theTransform = CGAffineTransformTranslate(theTransform, -whereTheMovieShouldBeCentered, 0);
// theTransform = CGAffineTransformRotate(theTransform, M_PI/2);
theTransform = CGAffineTransformTranslate(theTransform, 0, -theSpaceAboveTheMovie);
तो पेज पर केंद्रित देखना चाहिए पहले बाहर टिप्पणी दो
यहाँ आप देखना चाहिए फिल्म और स्थिति पट्टी घुमाया और अब केंद्रित
// theTransform = CGAffineTransformScale(theTransform, 1.0f/aspectRatio, 1.0f/aspectRatio);
// theTransform = CGAffineTransformTranslate(theTransform, -whereTheMovieShouldBeCentered, 0);
theTransform = CGAffineTransformRotate(theTransform, M_PI/2);
theTransform = CGAffineTransformTranslate(theTransform, 0, -theSpaceAboveTheMovie);
यहाँ आप यह घुमाया देखना चाहिए और केंद्रित
// theTransform = CGAffineTransformScale(theTransform, 1.0f/aspectRatio, 1.0f/aspectRatio);
theTransform = CGAffineTransformTranslate(theTransform, -whereTheMovieShouldBeCentered, 0);
theTransform = CGAffineTransformRotate(theTransform, M_PI/2);
theTransform = CGAffineTransformTranslate(theTransform, 0, -theSpaceAboveTheMovie);
और उन सब के साथ, यह घुमाया और फुलस्क्रीन
तुम मेरे नमूना कोड here डाउनलोड कर सकते हैं है।
मैं एक ही समस्या आ रही है की कोशिश करो। अभी भी कोई कामकाज नहीं है? – samvermette
मुझे भी। किसी को यह काम मिल गया है? – V1ru8
क्या आपको कोई जवाब मिला? – Jingwei