我正在製作一款小遊戲,如果您贏了,它會顯示一張圖片。圖像大小爲全屏。我想把它作爲當我tap
就可以了,它刪除和活動或viewController
做一些東西,然後重新開始。在iphone中製作彈出圖片
我有一個想法,我可以添加TAP Gesture recognizer
但我怎樣才能popup
一個圖像,停止在後臺的活動,然後在錄音後做一些東西,並重新啓動Controller
。
問候
我正在製作一款小遊戲,如果您贏了,它會顯示一張圖片。圖像大小爲全屏。我想把它作爲當我tap
就可以了,它刪除和活動或viewController
做一些東西,然後重新開始。在iphone中製作彈出圖片
我有一個想法,我可以添加TAP Gesture recognizer
但我怎樣才能popup
一個圖像,停止在後臺的活動,然後在錄音後做一些東西,並重新啓動Controller
。
問候
我有一個代碼在這裏取自facebook的示例iphone代碼。它通過動畫來回彈出一個視圖。
只需創建一個自定義按鈕,將其鏈接,在裏面添加圖像,調整框架/位置並隱藏它。
-(void) zoomInWorld{
buttonImage.hidden = NO;
buttonImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.2];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped)];
buttonImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
[UIView commitAnimations];
}
- (void)bounce1AnimationStopped {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.15];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped)];
buttonImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
[UIView commitAnimations];
}
- (void)bounce2AnimationStopped {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.15];
//[UIView setAnimationDidStopSelector:@selector(nextAction)];
buttonImage.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
[a addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlStateNormal];
}
要「彈出」的圖像,你可以只創建一個UIButton與圖像爲背景,並把它隱藏 - 彈出你只是使它可見。
只要連接到按鈕,您希望在按下按鈕時調用該方法。
子類UIView創建PopupView,顯示你需要它。覆蓋此功能:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[self setHidden:TRUE];
[self removeFromSuperview];
}