Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Uitableview iOS-带表视图和子视图的选项卡式应用程序_Uitableview_Subview_Tabbed View - Fatal编程技术网

Uitableview iOS-带表视图和子视图的选项卡式应用程序

Uitableview iOS-带表视图和子视图的选项卡式应用程序,uitableview,subview,tabbed-view,Uitableview,Subview,Tabbed View,我有一个问题。在我的应用程序中(它是选项卡式的),我有一个带有一些文本的viewcontroller,第二个带有表视图(RSS阅读器)。当我只有RSS并且它被设置为单视图应用程序时,子视图表单RSS工作,但是当我设置选项卡式应用程序并单击表视图中的某个帖子时,子视图没有显示。。。有人能帮我吗 这是我的密码: AppDelegate.h #import <UIKit/UIKit.h> @interface MWFeedParserAppDelegate : NSOb

我有一个问题。在我的应用程序中(它是选项卡式的),我有一个带有一些文本的viewcontroller,第二个带有表视图(RSS阅读器)。当我只有RSS并且它被设置为单视图应用程序时,子视图表单RSS工作,但是当我设置选项卡式应用程序并单击表视图中的某个帖子时,子视图没有显示。。。有人能帮我吗

这是我的密码:

AppDelegate.h

         #import <UIKit/UIKit.h>

@interface MWFeedParserAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;
    UINavigationController *navigationController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@end

从dealloc中,我看到您没有使用arc。 你有一些内存泄漏;确保在
didfishlaunchingwithoptions
中释放
vc1
vc2
,选项卡栏控制器将保留它们

您可能不需要
navigationController
属性,建议您删除该属性,直到您知道需要它为止

我想您应该先将RSS视图(vc2?)添加到导航控制器,然后再添加到选项卡栏控制器,如下所示:

[tbc setViewControllers:[NSArray arrayWithObjects:vc1, [[[UINavigationController alloc] initWithRootViewController:vc2] autorelease], nil]];
并删除该行:

[window addSubview:[navigationController view]];
祝你好运

编辑详细说明:

ViewController1 *vc1 = [[[ViewController1 alloc] init] autorelease];
RootViewController *vc2 = [[[RootViewController alloc] init] autorelease];
UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:vc2] autorelease];
UITabBarController *tbc = [[[UITabBarController alloc] init] autorelease];
[tbc setViewControllers:@[vc1, navController]];
[window makeKeyAndVisible];
[window setRootViewController:tbc];
ViewController1 *vc1 = [[[ViewController1 alloc] init] autorelease];
RootViewController *vc2 = [[[RootViewController alloc] init] autorelease];
UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:vc2] autorelease];
UITabBarController *tbc = [[[UITabBarController alloc] init] autorelease];
[tbc setViewControllers:@[vc1, navController]];
[window makeKeyAndVisible];
[window setRootViewController:tbc];