gpt4 book ai didi

ios - 如何通过点击使 UIView 移动?

转载 作者:行者123 更新时间:2023-12-01 18:59:00 28 4
gpt4 key购买 nike

我不确定我是否可以正确描述它。它是一种 UIView,我们只能看到它的一部分(可能带有箭头。在屏幕底部,可能)。用户可以点击它,这个 View 会全屏显示(通常开发者会留下一些额外的信息)。我怎样才能做到?

enter image description here

最佳答案

试试这个:

-(void)show
{
[viewObj setFrame:CGRectMake(viewObj.frame.origin.x,viewObj.frame.origin.y,viewObj.frame.size.width, viewObj.frame.size.height)];//Here "viewObj.frame.origin.y" means 568
[UIView animateWithDuration:0.5 animations:^
{
[viewObj setFrame:CGRectMake(viewObj.frame.origin.x,0,viewObj.frame.size.width, viewObj.frame.size.height)];
}
completion:^(BOOL finished)
{
}];
}

-(void)hide
{
[viewObj setFrame:CGRectMake(viewObj.frame.origin.x,viewObj.frame.origin.y,viewObj.frame.size.width, viewObj.frame.size.height)];//Here "viewObj.frame.origin.y" means 0
[UIView animateWithDuration:0.5 animations:^
{
[viewObj setFrame:CGRectMake(viewObj.frame.origin.x,568,viewObj.frame.size.width, viewObj.frame.size.height)];
}
completion:^(BOOL finished)
{
}];
}

关于ios - 如何通过点击使 UIView 移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24202478/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com