gpt4 book ai didi

iphone - xib 已加载但未加载以前的 View Controller ?

转载 作者:行者123 更新时间:2023-11-28 17:32:45 26 4
gpt4 key购买 nike

我已经使用基于选项卡的应用程序创建了一个应用程序。通过在第一个 View controller.xib 图像中选择一个按钮,第二个 View controller.xib 必须加载。我有第二个 View controller.xib 但问题是如果我选择第一个选项卡没有加载。这是我在 firstview.controller.h 中的代码

@property (unsafe_unretained, nonatomic) IBOutlet UIButton *aboutus;
- (IBAction)showabout:(id)sender;

firstviewcontroller.m

- (IBAction)showabout:(id)sender {
[[NSBundle mainBundle] loadNibNamed:@"SecondViewController" owner:self options:nil];}

最佳答案

试试这个:

- (IBAction)showabout:(id)sender 
{
SecondViewController *scv = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
[self.view addSubview:scv.view];
[scv release];
}

关于iphone - xib 已加载但未加载以前的 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10752330/

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