从另一个控制一个UITable

Zor*_*ran 2 iphone objective-c uitableview ios

我正在构建一个简单的iOS应用程序,其中有两个UITableViewController用于创建日期导航的水平表,(ScrollingDateViewController)第二个UITableView (LogItemsTableViewController)用于显示所选日期的已记录项目.

在我的viewDidLoad方法中,我有以下内容:

NSLog(@"show scrolling date selector");
scrollingDateViewController=[[ScrollingDateViewController alloc] initWithNibName:@"ScrollingDateView" bundle:[NSBundle mainBundle]];
CGRect rect=CGRectMake(0,330,320,100);    
scrollingDateViewController.view.frame=rect;
scrollingDateViewController.view.backgroundColor=[UIColor clearColor];
scrollingDateViewController.delegate = self;
[self.view addSubview:scrollingDateViewController.view];

NSLog(@"show log item selector");
logItemsTableViewController=[[LogItemsTableViewController alloc] initWithNibName:@"LogItemsView" bundle:[NSBundle mainBundle]];
rect=CGRectMake(0,0,320,330);    
logItemsTableViewController.view.frame=rect;
logItemsTableViewController.view.backgroundColor=[UIColor clearColor];
[self.view addSubview:logItemsTableViewController.view];

[super viewDidLoad];
Run Code Online (Sandbox Code Playgroud)

所有这两个表似乎都运行良好.我现在遇到的问题是如何在滚动日期表中选择新日期时控制日志项目表.我怀疑答案很简单,但我是iOS编程的新手,只是在解决这些问题.我很感激任何帮助.

Ham*_*abi 5

您需要实现此功能

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

为了你的ScrollingDateViewController.现在,在此功能中,您必须实现有关更改的想法LogItemsTableViewController.对于这样做,你必须访问UITableViewLogItemsTableViewController进入ScrollingDateViewController.

我希望它对你有用!