私はアプリを開発中です。アプリの開発中に問題があります。 問題は次のとおりです。画像と音声を表示
私はUIImageViewとオーディオを持っています。配列に20個の画像があります。このUIImageViewに20個の画像を時間間隔内で表示する必要があります。画像とともに、オーディオを設定する必要があります。私は同じ時間に見る必要があります。つまり、同時に20枚の画像と音声が来るはずです。
私のコードは以下の通りです。
alphabetsStoreArray = [[NSMutableArray alloc]initWithObjects:@"a.png",@"b.png",@"c.png",@"d.png",@"e.png",@"f.png",@"g.png",@"h.png",@"i.png",@"j.png",@"k.png",@"l.png",@"m.png",@"n.png",@"o.png",@"p.png",@"q.png",@"r.png",@"s.png",@"t.png",@"u.png",@"v.png",@"w.png",@"x.png",@"y.png",@"z.png", nil];
commonFunctionObject = [[SpeechCommonFunctions alloc]init];
commonFunctionObject.isRecordComplete = NO;
counter = 0;
isMicPresent = YES;
_confirmationPopupView.hidden = true;
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(repeatActionFire) userInfo:nil repeats:NO];
// Do any additional setup after loading the view.
}
-(void)repeatActionFire
{
if(counter >= alphabetsStoreArray.count)
{
NSLog(@"finished");
[_alphabetsShowImageView removeFromSuperview];
[_speakerOrMicImageView removeFromSuperview];
UIImageView *congratzView = [[UIImageView alloc]initWithFrame:self.view.frame];
congratzView.image = [UIImage imageNamed:@"congratulation.png"];
[self.view addSubview:congratzView];
[self performSelector:@selector(navNew) withObject:nil afterDelay:3];
}
else
{
[commonFunctionObject textToSpeechAction:alphabetsStoreArray :counter :_alphabetsShowImageView :_speakerOrMicImageView :isMicPresent];
[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(ActionToCkeckRecordCompletion) userInfo:nil repeats:YES];
}
}
-(void)ActionToCkeckRecordCompletion
{
if(commonFunctionObject.isRecordComplete)
{
_confirmationPopupView.hidden = false;
}
}
-(void)navNew
{
v11=[self.storyboard instantiateViewControllerWithIdentifier:@"maincontroller"];
[self presentViewController:v11 animated:NO completion:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
} */
-(IBAction)homebut:(id)sender{
UIAlertController * alert=[UIAlertController alertControllerWithTitle:@"Title"
message:@"Message"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* Home = [UIAlertAction
actionWithTitle:@"RETURN TO HOME"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
v11=[self.storyboard instantiateViewControllerWithIdentifier:@"maincontroller"];
[self presentViewController:v11 animated:NO completion:nil];
}];
UIAlertAction* Cancel = [UIAlertAction
actionWithTitle:@"CANCEL"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
}];
[alert addAction:Cancel];
[alert addAction:Home];
[self presentViewController:alert animated:YES completion:nil];
}
- (IBAction)playButtonAction:(id)sender
{
[commonFunctionObject recordPlayAction];
}
- (IBAction)nextButtonAction:(id)sender
{
counter+=1;
_confirmationPopupView.hidden = true;
commonFunctionObject.isRecordComplete = NO;
if(commonFunctionObject.player.playing){[commonFunctionObject.player stop];}
[self repeatActionFire];
}
- (IBAction)retryButtonAction:(id)sender
{
_confirmationPopupView.hidden = true;
commonFunctionObject.isRecordComplete = NO;
if(commonFunctionObject.player.playing){[commonFunctionObject.player stop];}
[self repeatActionFire];
}
どのようにすればよいですか?
オーディオシーク時間を取得し、画像の配列数で割った後、アニメーションの時間をUIImageviewに設定します。harish saran https://stackoverflow.com/questions/16585263/uiimage-animating-an-array-of-images – karthikeyan
どのようにここで行うことができますか?コード – jesteena