gpt4 book ai didi

objective-c - UIApplication sharedApplication 帮助?

转载 作者:行者123 更新时间:2023-11-28 17:43:40 25 4
gpt4 key购买 nike

我正在尝试访问一个创建导航 Controller 的变量,该导航 Controller 是我在 View Controller 中的 App Delegate 中定义的(我正在为每个选项卡构建一个带有 .plist 的选项卡栏应用程序,例如向下钻取应用程序).我正在尝试消除在非结构或联合的情况下显示“请求成员“indNavControl”的错误。有人可以帮我吗?

代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

A37dgAppDelegate *AppDelegate = (A37dgAppDelegate *)[[UIApplication sharedApplication] delegate];
self.indNavControl = [AppDelegate.indNavControl];

//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];

//Get the children of the present item.
NSArray *Children = [dictionary objectForKey:@"Children"];


if([Children count] == 0) {

DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];

A37dgAppDelegate *AppDelegate = (A37dgAppDelegate *)[[UIApplication sharedApplication] delegate];
[AppDelegate.indNavControll push indNavControl];
[self.indNavControl pushViewController:dvController animated:YES];
[dvController release];
}
else {

//Prepare to tableview.
IndustriesViewController *indViewControl = [[IndustriesViewController alloc] initWithNibName:@"IndustryView" bundle:[NSBundle mainBundle]];

//Increment the Current View
indViewControl.CurrentLevel += 1;

//Set the title;
indViewControl.CurrentTitle = [dictionary objectForKey:@"Title"];

//Push the new table view on the stack
A37dgAppDelegate *AppDelegate = (A37dgAppDelegate *)[[UIApplication sharedApplication] delegate];
[self.indNavControl pushViewController:indViewControl animated:YES];

indViewControl.tableDataSource = Children;

[indViewControl release];
}

真的,我想做的就是使用 UIApplication sharedApplication 方法引用我的 View Controller ,但我不知道该怎么做。

最佳答案

您是否在此处导入“A37dgAppDelegate.h”和“IndustriesViewController.h”?

关于objective-c - UIApplication sharedApplication 帮助?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7070989/

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