How to make two custom tableviews that works like a 2 rows uipickerview

I created a uiscrollview and add a uitableview as subview. I use this class to create two scrollivew each has added a tableview inside it. I want these 2 tableview works like uipickerview which has 2 rows in it. When I click a uitableviewcell on the left, the other tableview should reload it's data to match the selection. Just like a uipickerview, when click a item in row 0, row 1 updates it's data. I want to implement this functionality in tableview, the only difference is that i click the cell in tableview, not scroll item like uipickerview.

Answers


You need to keep reference of two tableViews, two seperate dataSource array. And when the mainTableView is selected, form the dataSource of the second tableView and reload it.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView.tag == 1) //Main TableView
    {
         //Form the dataSource of the second tableView
         //You need to have a logic to form this array  
         //from the selected indexPath of main tableView
         self.secondDataSourceArray = ...
         [self.secondTableView reloadData];
    }
}

Need Your Help

Grails redirect to a page in case of error

grails redirect

Here is a simple question. Is there any possibility of, if in any case there's an error in an application and the server show us an error page, instead redirect everything to a default page ?

Optimizing read-write operations in Settings class

c# .net wpf

Using Properties.Settings.Default is great to save UI settings.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.