Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何隐藏uiview用户不使用该视图?_Iphone_Ios5_Ios4 - Fatal编程技术网

Iphone 如何隐藏uiview用户不使用该视图?

Iphone 如何隐藏uiview用户不使用该视图?,iphone,ios5,ios4,Iphone,Ios5,Ios4,我有一个类似快捷方式的视图,带有一些按钮。现在,当我单击快捷按钮时,快捷方式视图显示现在我希望用户不触摸视图如何在8秒后隐藏快捷方式视图,以及在8秒前触摸视图。您可以使用UIView动画将视图移出屏幕 [UIView animateWithDuration:0.333f delay:8.0f options:UIViewAnimationCurveEaseOut anima

我有一个类似快捷方式的视图,带有一些按钮。现在,当我单击快捷按钮时,快捷方式视图显示现在我希望用户不触摸视图如何在8秒后隐藏快捷方式视图,以及在8秒前触摸视图。您可以使用UIView动画将视图移出屏幕

[UIView animateWithDuration:0.333f 
                      delay:8.0f 
                    options:UIViewAnimationCurveEaseOut 
                 animations:^(void) {
                      myView.transform = CGAffineTransformMakeTranslation(0,self.view.frame.size.height);
                           }
                 completion:nil];
在本例中,我将视图移动到屏幕底部,
CGAffineTransformMakeTranslation(x,y)
将视图的框架移动给定的x和y点

要把它移回去,好吧,你就明白了;)

您可以使用
-(void)performSelector:(SEL)一个带有object:(id)argument afterDelay:(NSTimeInterval)delay
+(void)cancelPreviousPerformRequestsWithTarget:(id)ataTarget
方法的选择器

-(void)showShortcuts
{
    // all the code you need to show your shortcuts view
    ...
    [self perfornSelector:@selector(hideShortcuts) withObject:nil afterDelay:8.0];
}

-(void)hideShortcuts
{
// all the code you need to hide your shortcuts view
...
}

-(void)shortcutPressed:(id) shortcut
{
    [NSObject cancelPreviousPerformRequestsWithTarget:self];
    // code your shortcut is supposed to trigger
    ...
}