1
收縮的UIView
我工作的一個iPhone遊戲,如應用程序,在這裏我要問一個問題,在UIButoons相應的答案。當用戶按下任意鍵我給出的答案選擇正確和錯誤的圖像。我用下面的代碼創建應答視圖並將其連接到主視圖:擴大和iPhone
-(void)ShowOutputImageAsAnswerView:(BOOL)correct
{
viewTimer = [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(RemoveSubViewFromMainView) userInfo:nil repeats:YES];
UIView *viewOutput = [[UIView alloc]initWithFrame:CGRectMake(200, 100, 80, 80)];
viewOutput.tag = 400;
viewOutput.backgroundColor = [UIColor clearColor];
UIImageView *imgAns = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 70, 70)];
if (correct)
{
imgAns.image = [UIImage imageNamed:@"correct_icon.png"];
}
else
{
imgAns.image = [UIImage imageNamed:@"wrong_icon.png"];
}
[viewOutput addSubview:imgAns];
[self.view addSubview:viewOutput];
[self.view bringSubviewToFront:viewOutput];
[imgAns release];
[viewOutput release];
}
我必須展示在動畫形式這個答案視圖。而這個動畫將開始從0像素80像素。是指擴大和縮小視圖。
它如何實現? 可直接與imgAns使用嗎?