gpt4 book ai didi

ios - UIView 隐藏一次后不显示

转载 作者:行者123 更新时间:2023-11-28 20:07:03 34 4
gpt4 key购买 nike

我在 ViewController 上有一个名为 scoreViewUIView。当我加载 ViewController 时,我将 scoreView 隐藏在 viewDidLoad 方法中。它工作正常。

- (void)viewDidLoad{

[super viewDidLoad];
self.navigationController.navigationBarHidden = YES;
scoreView.hidden = YES;

}

然后在从另一个 View Controller 推送到此 ViewController 之后,我调用了一个方法,我想在其中显示 scoreView。但是 scorView 仍然被隐藏。我哪里做错了?

-(void)levelCompleteViewAppear: (NSString *)score{

NSLog(@"This method is called!");
scoreView.hidden = NO ;
[gameScore setText:score];

}

这就是我从另一个 View Controller 推送到 ViewController 的方式。

-(void)levelComplete{

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
ViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[self.navigationController pushViewController:vc animated:YES];
[vc levelCompleteViewAppear:scoreLabel.text];

}

最佳答案

试试这个,

-(void)viewDidLoad
{
[super viewDidLoad];
[self.view addSubview:scrollview];
[self.view bringSubviewToFront:scrollview];
}

关于ios - UIView 隐藏一次后不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21753431/

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