如何更改弹出控制器中的标签栏时更新详细视图中的UITableView? [英] How to update a UITableView in detailview when changes the tabbar in the pop over controller?

查看:93
本文介绍了如何更改弹出控制器中的标签栏时更新详细视图中的UITableView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个带有splitview的iPad应用程序,这是屏幕截图,

在这一个中,当我更改主视图控制器(左侧)中的选项卡时,我想更新右侧tableview中的值。哪个是好的方法,我应该为每个标签更改加载另一个viewcontroller吗?可能吗?或者只是更新表格?对于所有选项卡更改,我想显示包含不同数据的tableview。
我使用下面的代码,我可以看到日志中的变化,但表格没有得到更新。

I am creating an iPad app with splitview, here is the screen shot, In this one, I want to update the values in the righthand side tableview, when I change the tab in the masterview controller (left hand side). Which will be the good aproach, Should I load another viewcontroller for each tab change? Is it possible? Or just update the table? For all the tab changes i want to display a tableview with different data. I used following code, i can see the changes in the log, but the table is not getting updated.

- (void)setDetailItem:(id)newDetailItem
{
    if (_detailItem != newDetailItem) {
        [_detailItem release]; 
        _detailItem = [newDetailItem retain]; 

        // Update the view.
        [self configureView];
    }

    if (self.masterPopoverController != nil) {
        [self.masterPopoverController dismissPopoverAnimated:YES];
    }        
}

- (void)configureView
{
    // Update the user interface for the detail item.
    if (isStudent) {
        textStr = @"student";
        NSLog(@"Student....%@",textStr);
        [self.tableView reloadData];
    }if (isTeachers) {
        textStr = @"teacher";
        NSLog(@"Teacher....%@",textStr);

        [self.tableView reloadData];
    }if (isPreference) {
        textStr = @"preference";
        NSLog(@"Preference....%@",textStr);

        [self.tableView reloadData];
    }if (isConfiguration) {
        textStr = @"configuration";
        NSLog(@"Configuration....%@",textStr);

        [self.tableView reloadData];
    }
}

我也尝试了

[self performSelectorOnMainThread:@selector(refreshTableView) withObject:nil waitUntilDone:NO];

请分享您的想法。
谢谢:)

Please share your ideas. thanks :)

推荐答案

最后我自己发现了这个问题,我真的非常善于寻找解决方案。我已经浏览了几个论坛和教程。最后我想出了这个问题。在这个视频中,他们已经说明了如何使用创建SplitView应用程序XCode 4.2。在这一篇中,只有一行代码解决了这个问题。那是在Appdelegate.m文件中。默认情况下,MasterViewController无权访问详细信息视图,因此如果我们需要在detailview上执行某些操作,则必须连接masterviewcontroller和detailviewcontroller。检查视频,然后你会(那些面临同样问题的人)理解。

At last I found the issue myself, and I was really great to search for a solution. I have went through several forums and tutorials. Finally I figured out the issue. And in this video, they have illustrated how to create a SplitView application using XCode 4.2. In this one, just one line of code fixed the issue. That is in the Appdelegate.m file. In default, the MasterViewController doesn't have access to the detail view, so if we need to do something on the detailview, we have to connect masterviewcontroller and detailviewcontroller. Check the video, then you will (those who are facing the same issue) understand.

谢谢:)

这篇关于如何更改弹出控制器中的标签栏时更新详细视图中的UITableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆