gpt4 book ai didi

ios - 将 UILabel 设置为隐藏

转载 作者:行者123 更新时间:2023-12-01 16:33:47 25 4
gpt4 key购买 nike

我有这段代码,它设置了一些标签,隐藏了一些标签,然后删除了我从屏幕上制作的自定义加载 View ,这里是代码:

self.yourPlanLabel.text = [infoArray objectAtIndex:0];
self.yourMealLabel.text = [infoArray objectAtIndex:1];
self.yourBalanceLabel.text = [infoArray objectAtIndex:2];
self.usernameField.hidden = YES;
self.passwordField.hidden = YES;
self.loginBtn.hidden = YES;
self.yourPlanLabel.hidden = NO;
self.yourMealLabel.hidden = NO;
self.yourBalanceLabel.hidden = NO;
//remove loading view
[self.loadingView removeFromSuperview];

但是加载 View 首先消失,然后几秒钟后标 checkout 现/消失,具体取决于我设置的内容,为什么加载 View 在代码底部时首先消失?

谢谢您的帮助 :)

这是我如何调用加载 View :
self.loadingView = [[LoadingView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.loadingView];
[self.navigationController.view addSubview:self.loadingView];
[self.loadingView setCenter:CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2 +32)];

这是加载 View 的 .m

https://gist.github.com/anonymous/e0a34fb49375dfeaca39

我现在正在这样做
dispatch_async(dispatch_get_main_queue(), ^{
self.yourPlanLabel.text = [infoArray objectAtIndex:0];
self.yourMealLabel.text = [infoArray objectAtIndex:1];
self.yourBalanceLabel.text = [infoArray objectAtIndex:2];

self.usernameField.hidden = YES;
self.passwordField.hidden = YES;
self.loginBtn.hidden = YES;

self.mealLabel.hidden = NO;
self.planLabel.hidden = NO;
self.balanceLabel.hidden = NO;
self.yourPlanLabel.hidden = NO;
self.yourMealLabel.hidden = NO;
self.yourBalanceLabel.hidden = NO;
self.loadingView.hidden = YES;
[self.loadingView removeFromSuperview];
});

而且还是不行?

最佳答案

如果你在 viewDidLoad 中做以上所有设置,请尝试将隐藏功能移入
viewDidAppear。

所以这是

-(void)viewDidAppear
{
[self.loadingView removeFromSuperview];
}

关于ios - 将 UILabel 设置为隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30113280/

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