質問

私はrightcalloutaccessoryviewボタンを押して上に新しいビューを追加したいです。私は現在、地図上のピンをドロップするための機能を持っています。 Iピンをタップタイトル、サブタイトル、およびシェブロン負荷とコールアウト(MKAnnotation)。私はシェブロン(rightcalloutaccessoryview)をタップすると私は別のビューは、この時点でより多くの情報を示すポップアップ表示します。今、山形タップは何もしません。これは私が持っているものです。

-(IBAction)showInfo:(id)sender 
{     
     int calloutButtonPressed = ((UIButton *)sender).tag;
     if(calloutButtonPressed < 99999)
     {
          if(self.DetailView == nil)
          {
               DetailViewController *tmpViewController = [[UIViewController alloc] initWithNibName:@"DetailView" bundle:nil];
               self.DetailView = tmpViewController;
               [tmpViewController release];
          }

          if (calloutButtonPressed == 1) 
          {
                         // Using the debugger, I found that calloutButtonPressed is equal to 0 when the button is pressed.
                         // So I'm not sure what the point of this method is...
                }
          self.DetailView.title = @"Title";
     }
 }

私は、このアクションメソッドは、シェブロンを押した時に呼び出さないことを確認しました。残念ながら、私はそれが新しいビューをプルアップするために取得することはできません。誰もが私が間違ってやっていることを知っている場合は、私に知らせてください。私がピンチのビットにいるよ...

ありがとうございます。

トーマス

役に立ちましたか?

解決

    -(IBAction)showInfo:(id)sender 
{   
     int calloutButtonPressed = ((UIButton *)sender).tag;
     if(calloutButtonPressed < 99999)
     {
          if(self.detailView == nil)
          {
               DetailViewController *tmpViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
               self.detailView = tmpViewController;
               [tmpViewController release];
          }

          [self.navigationController pushViewController:self.detailView animated:YES];

          if (calloutButtonPressed == 0) 
          {
               // TRP - I inserted my view atIndex:99999 to ensure that it gets placed in front of all windows
               // TODO: figure a better way to do this
               [self.view insertSubview:detailView.view atIndex:99999];
          }
          self.detailView.title = @"Title";
     }

}

これは、この1文が欠落しています:

[self.view insertSubview:detailView.view atIndex:99999];

私は(...プラス、それはちょっと未熟と思われる)ので、私はそこにそのマジックナンバー(99999)を持っている必要はありません別の方法を見つけるしたいと思います。それはしかし動作しますので、私は、それについてTOO心配していない。

私はここのAppleデベロッパフォーラムから私の助け、を得ました。

scroll top