0

こんにちは、あるページでボタンを押して別のビューに接続するとエラーが発生します

よろしくお願いします!

これが私のコードです

-(void)buttonPressed:(UIButton *)button
{
NSLog(@"button %u -- frame: %@", button.tag, NSStringFromCGRect(button.frame));
[self performSegueWithIdentifier:@"WeekView" sender:self];

}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString: @"WeekView"]){

    [segue.destinationViewController setTitle:@"WeekView"];
    }}

この行のこのエラー

with debugging = Signal Sigabrat start from here

 [self performSegueWithIdentifier:@"WeekView" sender:self];

また、Segue で WeekView を特定し、shipt+command+K を使用してクリーンアップしますが、それでもエラーが発生します

4

1 に答える 1

0

プロパティを変更する前に、destinationviewcontroller を初期化する必要があります。

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString: @"WeekView"]){

SecondViewController*second=segue.destinationViewController;   //You´re missing this line.

second.title=@"WeekView";    // now you can do stuff on your destinationViewController



    }}

それが修正されることを願っています。

于 2012-07-03T06:21:16.623 に答える