gpt4 book ai didi

ios - 在 iOS 中显示和删除相同的按钮

转载 作者:行者123 更新时间:2023-11-29 02:46:49 25 4
gpt4 key购买 nike

我有一个UIButton。现在我在 Subview 上添加按钮:-

UIButton* button4 = [[UIButton alloc] initWithFrame:frame4];
[button4 setBackgroundImage:image3 forState:UIControlStateNormal];
[button4 setShowsTouchWhenHighlighted:YES];
[button4 addTarget:self action:@selector(Nofication:) forControlEvents:UIControlEventTouchDown];

- (void)Nofication:(id)sender
{
share=[[UIView alloc]init];
share.frame=CGRectMake(300, 60, 130, 100);
[self.view addSubview:share];

[UIView animateWithDuration:2.0
animations:^{
share.frame =CGRectMake(180, 50, 130, 100); // its final location
}];
share.backgroundColor=[UIColor yellowColor];

login=[[UIButton alloc]init];
login.frame=CGRectMake(0, 0, 130, 50);
[login setBackgroundImage:[UIImage imageNamed:@"login.png"] forState:UIControlStateNormal];
[login addTarget:self action:@selector(asubmit:) forControlEvents:UIControlEventTouchDown];
[share addSubview:login];
login.layer.borderColor = [[UIColor whiteColor]CGColor];

policies=[[UIButton alloc]init];
policies.frame=CGRectMake(0, 50, 130, 50);
[policies setBackgroundImage:[UIImage imageNamed:@"Policies.png"] forState:UIControlStateNormal];
[policies addTarget:self action:@selector(apolicies:) forControlEvents:UIControlEventTouchDown];

[share addSubview:policies];
}

当我单击按钮时,它打开的 subview 工作得很好。但现在我需要如果 subview 在单击按钮时显示,则需要隐藏 subview 。如果当我单击按钮时 subview 没有显示,则需要显示 subview。所以请给我任何想法。

如何显示和隐藏相同的UIButton

提前致谢。

最佳答案

关于ios - 在 iOS 中显示和删除相同的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25013336/

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