这有可能让我所有的朋友都喜欢吗?现在,我通过两个步骤得到这个:
但这似乎是一个非常大的过程,任何人都有想法改善这项任务的性能?
我使用以下ViewController.m创建了一个新项目.当我运行应用程序时,我可以看到一个预期的原点/大小的框(38,100,250,163),但它是黑色的,没有视频播放.Xcode中有一个奇怪的输出:
2012-08-23 15:36:45.559 VideoTest1[11398:c07] [MPAVController] Autoplay: Disabling autoplay for pause
2012-08-23 15:36:45.560 VideoTest1[11398:c07] [MPAVController] Autoplay: Disabling autoplay
2012-08-23 15:37:18.186 VideoTest1[11398:c07] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
Run Code Online (Sandbox Code Playgroud)
请注意,视频使用Videora iPhone Converter进行转换,并在Xcode中播放正常(因此不会出现视频问题); 视频的路径是可以的,因为当我指定demo-iPhone1(不存在)时,我得到一个零例外.我试过在模拟器和iPhone上:总是黑盒子.有任何想法吗?
#import "ViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)moviePlaybackComplete:(NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view removeFromSuperview];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a …Run Code Online (Sandbox Code Playgroud) 我想缩放+翻译视图,然后将此转换动画回来.但是CGAffineTransformInvert返回一个不同的变换(无法理解它的逻辑).
#import <UIKit/UIKit.h>
@interface TestView : UIView {
UIView *view;
CGAffineTransform transform;
}
@end
#import "TestView.h"
#import <QuartzCore/QuartzCore.h>
@implementation TestView
- (void)testAnimation:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context {
CGAffineTransform transformInverted = CGAffineTransformInvert(transform);
[UIView beginAnimations:@"test2" context:NULL];
[UIView setAnimationDuration:3.0];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
view.transform = transformInverted;
[UIView commitAnimations];
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
view = [[UIView alloc] initWithFrame:CGRectMake(150, 150, 100, 100)];
view.backgroundColor = [UIColor greenColor];
[self addSubview:view];
CGAffineTransform transform1 = CGAffineTransformTranslate(view.transform, -150, -150);
transform = CGAffineTransformScale(transform1, (float)1/2, (float)1/2); …Run Code Online (Sandbox Code Playgroud)