0

iPhoneの表示について質問です。XCode のタブ バー テンプレートに基づくアプリがあります。タブ ビューの 1 つが TableView です。そのテーブル ビューで、ユーザーがセルの 1 つを選択すると、これに関する詳細を表示するビューをロードする必要があります。

今、私は持っています:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    SportsAppDelegate *appDelegate = (SportsAppDelegate *)[[UIApplication sharedApplication] delegate];


    // Deselect
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];

//Process which one, sets an index

    //Show detail
    SportsGameView *detail = [[SportsGameView alloc] init];
    [detail setMe:index];  //sets the index that tells it which one

    [appDelegate.window insertSubview:detail.view atIndex:0];
    [self.view removeFromSuperview];
    [detail release];
}

SportsGameView (一番上にロードしようとしているもの) 内で、これらを使用して一連の UILabels を初期化するように setMe を定義しました。

これらを取得することは確認できますが、どういうわけか、実際には表示されません。.xib と何か関係があると思われます。通常どおり、SportsGameView で IBOutlets を定義し、Interface Builder でそれらを接続しました。

理由を知っている人はいますか?

これが少し混乱した場合は申し訳ありません。

ありがとう!

4

1 に答える 1

1

insertSubview:... atIndex:0他のすべてのサブビューの「下」にビューを追加すると、おそらくビューを追加したくないでしょう。

上に置きたい場合は、 を使用してaddSubview:ください。

于 2010-12-04T18:53:31.600 に答える