我正在尝试从没有音频文件的 png 图像创建视频。
我已经实现了以下代码,但我的图像运行不顺畅。
- (void)viewDidLoad
{
totalImages = 121;
counter=1;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)viewDidAppear:(BOOL)animated
{
levelTimer = [NSTimer scheduledTimerWithTimeInterval:0.40 target: self selector: @selector(levelTimerCallback:) userInfo: nil repeats: YES];
}
- (void)levelTimerCallback:(NSTimer *)timer
{
if(counter <= totalImages)
{
NSString *fileName = [NSString stringWithFormat:@"image_iphone_%d",counter];
NSLog(@"filenameEasy:%@",fileName);
NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:@"png"];
UIImage *imageName = [[UIImage alloc] initWithContentsOfFile:fileLocation];
imgV.image = imageName;
counter++;
NSLog(@"counter:%d",counter);
[imageName release];
[self viewDidAppear:NO];
}
}
如果你有任何想法请分享。提前谢谢。