0
我正在顯示一個視圖,其上有一個按鈕。單擊此按鈕時,我將通過Objective C中定義的動畫方法顯示PopUp視圖,並通過彈出視圖添加圖像然後在任何點擊視圖時,這個彈出視圖隱藏,將其寬度和高度設置爲零,但其上的圖像不隱藏。可以隱藏它嗎?? 這些方法我用..作出輕敲觸摸的觀點後如何通過動畫在視圖中隱藏內容
這種方法點擊按鈕後,叫..
-(void)btnImageClkForPopUp:(id)sender
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.5];
popup_viewforimage.frame=CGRectMake(8, 30, 300, 250);
popup_viewforimage.backgroundColor=[UIColor whiteColor];
UIImageView *imgview=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 300, 250)];
imgview.image=[UIImage imageNamed:@"apple.jpeg"];
[popup_viewforimage addSubview:imgview];
[self.view addSubview:popup_viewforimage];
[UIView commitAnimations];
}
這兩種方法稱爲隱藏這個
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isKindOfClass:[UIButton class]])
{
return NO;
}
return YES;
}
-(void)hidekeyboard
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.5];
popup_viewforimage.frame= CGRectMake(15, 65, 0, 0);
popup_viewforimage.backgroundColor=[UIColor grayColor];
[self.view addSubview:popup_viewforimage];
[UIView commitAnimations];
}