单击同一按钮隐藏和显示 uitoolbar
我试图在 BarButtonItem 单击时隐藏和显示 UIView
。之前我也发布了有关相同的问题,但没有找到任何合适的答案。我在IB中手动创建了UIView并将其放置在视图中,因此它必须在视图加载后立即显示,但我通过
myvew.hidden = YES;
第二次编写将其隐藏在viewDidLoad方法中,当我单击BarButtonItem时,我设置了
-(IBAction)mymethod
{
myview.hidden = NO;
}
它的显示视图,但是当我再次点击它它必须隐藏..我该怎么做?
I am trying to hide and display a UIView
on BarButtonItem click. Priviously i also posted the question regarding same but didnt find any suitable answer. I created UIView manually in IB and just placed it in view so it must be shown as soon as view is loaded but i made it hidden in viewDidLoad method by writing
myvew.hidden = YES;
secondly, when i click BarButtonItem then i set
-(IBAction)mymethod
{
myview.hidden = NO;
}
so its diplaying view but when i again click on it it must hide.. how do i do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将以下语句放入按钮操作中,
因此您的代码必须如下所示。
Put the following statement in your button action
So your code must be like below.
检查视图是否已隐藏然后显示,如果没有隐藏则隐藏它。
Check if the view is already hidden and then show, and if not hidden then hide it.
你应该这样做
You should do in this way