Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.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
Ios JASidePanels黑匣子_Ios_Cocoa Touch - Fatal编程技术网

Ios JASidePanels黑匣子

Ios JASidePanels黑匣子,ios,cocoa-touch,Ios,Cocoa Touch,请看下图。请记住,我也在使用xcode 4.5.2。我遵循了示例2中JASidePanels上的示例,但我似乎无法摆脱这个黑匣子!否则,侧面板实际上会按预期工作。=) 我的centerViewController和leftViewController看起来也一样(代码如下)。但是,当我试着像示例中所说的那样去做时,我没有任何这样的运气,所以我不得不对JASidePanelController进行子类化: centerViewController.h: #import "JASidePanelC

请看下图。请记住,我也在使用xcode 4.5.2。我遵循了示例2中JASidePanels上的示例,但我似乎无法摆脱这个黑匣子!否则,侧面板实际上会按预期工作。=)

我的centerViewController和leftViewController看起来也一样(代码如下)。但是,当我试着像示例中所说的那样去做时,我没有任何这样的运气,所以我不得不对JASidePanelController进行子类化:

centerViewController.h:

#import "JASidePanelController.h"

@interface centerViewController : JASidePanelController

@end
centerViewController.m

#import "centerViewController.h"

@interface centerViewController ()

@end

@implementation centerViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
我会错过什么吗?我已经注释掉了几行代码,以删除主JASidePanelController本身上的rightViewController,我认为这可能会导致问题,而且只会导致更多问题。我没有示例中rightViewController的代码,因为我只是使用左视图和中视图。因此,我将代码设置回其默认值,我的模拟器中的应用程序上留下了一个黑框


提前谢谢

不要从中心视图控制器的
JASidePanelController
继承。将
JASidePanelController
视为可以容纳3个视图控制器的容器视图。下面是我的
AppDelegate
项目中的一个示例:

self.panelController = [[JASidePanelController alloc] init];

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *centerViewController = [storyboard instantiateInitialViewController];
self.panelController.centerPanel = centerViewController;
self.panelController.delegate = centerViewController;
self.panelController.rightPanel = [[DBRightViewController alloc] init];
self.panelController.leftPanel = [[DBLeftViewController alloc] init];
这样想,您需要一个单独的
JASidePanelViewController
,它将容纳其他视图控制器。这可以是
JASidePanelViewController
的子类,但只要将对它的引用存储在某个地方,就可能不需要它。在我的示例中,我将
panelController
作为属性存储在我的
AppDelegate


然后,您的每个ViewController都将是
UIViewController

的子类。我以为您应该使用#import函数继承所有内容,至少我是这么理解的。现在,您是将其放在JASidePanelController文件中,还是在centerViewController本身中?这是一个很好的例子,很抱歉我不太明白!但如果你能扩展它,我可能会得到它…对不起,非常感谢你!更新了我的答案,希望能有更多帮助。好吧……我想我现在明白了!所以我假设你把这个放到AppDelegate.m中,然后呢?我必须承认这是我的第一个iOS应用程序,只是在尝试学习。这个特定的实现和文档对于什么东西会用到哪里并不十分清楚,所以我正在尝试和错误中学习。是的,如果您希望它成为您的根视图控制器。非常感谢,我非常感谢!我会继续玩它,看看它会把我带到哪里。