Ich möchte einen schnellen Bild/Film-Viewer erstellen - für eine Geburtstagsfeier. Zuerst möchte ich ein paar Bilder zeigen - dann einen Film - und dann noch ein paar Bilder. Die erste Bildanimation zeigt sich gut, Film startet gut und AVPlayerItemDidPlayToEndTimeNotification fängt gerade gut an, Bilder wieder zu starten, - aber zweite Animation startet nie - ich kann das nicht durcharbeiten ?? - DoShow1 funktioniert nicht - bitte jemanden da draußen beraten? Die zweite Bildanimation funktioniert nicht - was ist los?
- (void)DoShow
{
NSArray *imageNames = @[@"1.jpg", @"2.jpg", @"3.png", @"4.png",
@"5.png", @"6.png",@"7.png", @"8.png",
@"9.png", @"10.png", @"11.png",@"12.png",
@"13.png"];
NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 0; i < imageNames.count; i++) {
[images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]];
}
_imageview.animationImages = images;
_imageview.animationDuration = 10;
_imageview.animationRepeatCount = 1;
[_imageview startAnimating];
[self performSelector:@selector(playmovie) withObject:nil afterDelay: 10];
}
- (void)DoShow1
{
NSArray *imageNames = @[@"14.jpg", @"16.jpg", @"18.jpg", @"19.jpg",
@"20.jpg", @"22.jpg",@"23.jpg", @"24.jpg"];
NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 0; i < imageNames.count; i++) {
[images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]];
}
_imageview2.animationImages = images;
_imageview2.animationDuration = 2;
_imageview2.animationRepeatCount = 100;
[_imageview2 startAnimating];
}
- (void) playmovie
{
MyMusicPlayerManager *sharedManager = [MyMusicPlayerManager sharedManager];
[sharedManager ChkPaused];
NSBundle *Bundle = [NSBundle mainBundle];
NSString *moviePath = [Bundle pathForResource:@"stine_ane" ofType:@"mp4"];
NSLog(@"String is %@", moviePath);
NSURL *url = [NSURL fileURLWithPath:moviePath];
AVPlayerItem *video = [[AVPlayerItem alloc] initWithURL:url];
AVQueuePlayer *queue = [[AVQueuePlayer alloc] initWithItems:@[video]];
video = [[AVPlayerItem alloc] initWithURL:url];
[queue insertItem:video afterItem:nil];
self.avmovieplayer = [[AVPlayerViewController alloc] init];
self.avmovieplayer.player = queue;
[self presentViewController:self.avmovieplayer animated:YES completion:nil];
self.avmovieplayer.player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(myMovieFinishedCallback:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[avmovieplayer.player currentItem]];
[self.avmovieplayer setShowsPlaybackControls:YES];
[self.avmovieplayer.player play];
}
- (void)myMovieFinishedCallback:(NSNotification *)notification {
[self dismissViewControllerAnimated:YES completion:Nil];
[self DoShow1];
}
- (IBAction)DoStart:(id)sender {
[self DoShow];
}
sind Sie sicher, 'DoShow1' genannt wird? Ist das imageView2 sichtbar? – Shubhank
imageView2 ist sichtbar und DoShow1 wird aufgerufen - wenn ich den Film nicht spiele DoShow und DoShow1 funktioniert gut - es ist etwas mit [selbst presentViewController: self.avmovieplayer animiert: YES completion: nil]; - Ich denke - und danke für Ihre Antwort :) – TheSnakeWizard