iPhone 观看问题

发布于 2024-10-06 00:46:03 字数 989 浏览 0 评论 0原文

我有一个关于 iPhone 上的视图的问题。我有一个基于 XCode 中的选项卡栏模板的应用程序。选项卡视图之一是 TableView。在该表视图中,当用户选择其中一个单元格时,我希望它加载一个显示更多详细信息的视图。

现在,我有:

- (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(我试图在顶部加载的那个)中,我定义了 setMe 来用这些来初始化一堆 UILabel。

我可以确认它得到了这些,但不知何故,它实际上并没有出现。我怀疑这与我的 .xib 有关。我像平常一样在 SportsGameView 中定义了 IBOutlet,并将它们连接到 Interface Builder 中。

有人知道为什么吗?

抱歉,如果这有点令人困惑。

谢谢!

So I have a question about views on iPhone. I have an app based on the Tab Bar template in XCode. One of the tab views is a TableView. In that table view, when a user selects one of the cells, I want it to load a view that shows more details about this.

Right now, I have:

- (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];
}

Within the SportsGameView (the one I'm trying to load on top), I have setMe defined to initalize a bunch of UILabels with these.

I can confirm it gets these, but somehow, it doesn't actually show up. I suspect it has something to do with my .xib. I defined IBOutlets in SportsGameView as I normally would, and hooked them up in Interface Builder.

Anyone know why?

Sorry if this was a bit confusing.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小姐丶请自重 2024-10-13 00:46:03

您可能不想使用 insertSubview:... atIndex:0 添加视图,这会将其置于所有其他子视图的“下方”。

如果你想把它放在上面,只需使用addSubview:

You probably don't want to add the view with insertSubview:... atIndex:0, which will put it "below" all other subviews.

If you want to put it on top, just use addSubview:.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文