0

我从 Apple 的 QuartzDemo 项目中获取了一些东西,并正在尝试对其进行修改。

我想创建一个带有按钮的屏幕,然后调用其余的东西来制作该演示中的矩形。

我创建了一个 UIViewController 来处理我的初始视图。它上面有一个开始按钮。开始按钮代码为:

- (IBAction)startButtonAct:(id)sender
{
    QuartzViewController *controller;

    NSLog(@"1");
    controller = [[QuartzViewController alloc] initWithTitle:@"Name"];
    controller.quartzViewDelegate = [[[RectDrawing alloc] init] autorelease];
    [[self navigationController] pushViewController:controller animated:YES];

}

它在与“controller.quartzViewDelate”在线时死亡:

-(id<QuartzViewDelegate>)quartzViewDelegate
{
    return quartzView.delegate;
}

出现错误:

-[QuartzView setDelegate:]: unrecognized selector sent to instance 0x5274a0

我猜这意味着 startButtonAct 的发件人 id 对quartzViewDelegate 来说不是正确的——它需要的不是按钮的id。

但我完全停在这里。经过数小时的工作,我不知道如何使这项工作。我能发现的区别是,QuartzDemo使用的是navigationController,而不是viewController,但是在我的阅读中,似乎navigation controller基本是用于table的,我没有。

好的,我对这些东西很陌生,但是 Objective C 和 iPhone 编程,ObjC 有时让我很适应,但我已经追查过了,没有更多的想法。

请帮忙?

4

1 回答 1

0

Found the error. Some code in the wrong place... nothing that could help anyone else.

于 2009-06-13T22:15:31.203 回答