我有一個應用程序,下面列出的代碼顯示了最終用戶的隨機問題。我試圖弄清楚如何讓用戶能夠在隨機顯示的數組中向後導航。例如,用戶正在經歷這些問題,並意外地前進了一個並想要返回,我希望他們能夠簡單地點擊後退按鈕。你能提供關於如何做到這一點的指導嗎?非常感謝你!!!記住隨機數組中的上一個輸出
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
myArray5= [NSArray arrayWithObjects:
@"Question 1",
@"Question 2",
@"Question 3",
@"Question 4",
nil];
int chosen = arc4random() % [myArray5 count];
NSString *item = [myArray5 objectAtIndex: chosen];
label3.text = [NSString stringWithFormat: @"%@", item];
label3.alpha = 0;
label3.transform = CGAffineTransformIdentity;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
label3.alpha = 1;
label3.transform = CGAffineTransformMakeScale(1, 1);
[UIView commitAnimations];
UITouch *touch = [[event allTouches] anyObject];
if (touch.tapCount == 2) {
}
}