1

ボタン付きのUIViewControllerを作成します。ボタンの唯一の仕事は、いくつかの長方形を描画するためのウィンドウを作成することです。(私はAppleのサンプルアプリケーションの「QuartzDemo」からいくつかのコードを取りました。)ObjectiveCは本当に私にフィット感を与えています...

これを試してみると何も起こりません。

ボタンのコードは次のとおりです。

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

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

}

正直なところ、他に何を見る必要があるのか​​わかりませんが、他にいくつかあります。

@interface QuartzViewController : UIViewController
{
    QuartzView *quartzView;
    UIBarStyle barStyle;
    UIStatusBarStyle statusStyle;

}


@protocol QuartzViewDelegate;

@interface QuartzView : UIView {

id<QuartzViewDelegate> delegate;

}

@property(assign) id<QuartzViewDelegate> delegate;

@end

@protocol QuartzViewDelegate<NSObject>

@required

// Draw contents into the given view, using the given context and bounds.
-(void)drawView:(QuartzView*)view inContext:(CGContextRef)context bounds:(CGRect)bounds;

@end

助けてください-これは私を夢中にさせています-私は今1週間同じ基本的な問題と戦っています...

4

1 に答える 1

1

まず、[コントローラーリリース]行がコメントなしでそこにあるはずです。デバッグのために無効にしたと思います。

行を挿入する場合:

NSLog(@"%@", [self navigationController]);

ボタンアクションで、有効なコントローラーをログに記録しますか、それともnilと表示しますか?ゼロの場合、このビューコントローラーがナビゲーションコントローラー自体に適切にプッシュされていなかったと思います。

于 2009-06-13T23:31:14.827 に答える