gpt4 book ai didi

基于 iPhone View 的应用程序,无需重新加载 View

转载 作者:行者123 更新时间:2023-11-29 04:45:23 24 4
gpt4 key购买 nike

我正在构建基于 View 的应用程序,它有很多页面,每个页面都有主页按钮,它将调用主页,但我的问题是每当我调用主页时, View 都会重新加载,但我不需要重新加载,所以请建议我....

主页.m

- (void)viewDidLoad {
[super viewDidLoad];
twitAll=0;
facAll=0;
CrtPage=0;
flag=[[NSString alloc]init];
[self Maintainpages];
[tbv setFrame:CGRectMake(0*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)];
[tbv1 setFrame:CGRectMake(1*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)];
[tbv2 setFrame:CGRectMake(2*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)];
[tbv3 setFrame:CGRectMake(3*self.scrollView.frame.size.width,0,self.scrollView.frame.size.width,self.scrollView.frame.size.height-90)];
tbv1.hidden=YES;
tbv2.hidden=YES;
tbv3.hidden=YES;
tbv.hidden=YES;
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"Background-bluegray.png"]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(LoginCompletedSuccess:) name:@"IntigrateCompleted" object:nil];
topbar.backgroundColor=[[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"top-bar.png"]]autorelease];
bottombar.backgroundColor=[[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"top-bar.png"]]autorelease];
}

最佳答案

为了不重新加载 View ,您应该使用此源代码将所有 newView 添加为父 View 的 subview 。

[parentView addSubview:childView];

并将此 subview 置于前面

[parentView bringSubviewToFront:childView];

单击主页按钮时,删除所有 subview ,它会成为您的父 View

for(UIView *subview in [parentView subviews]) {
[subview removeFromSuperview];
}

关于基于 iPhone View 的应用程序,无需重新加载 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9732195/

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