How can i achieve following functionality.
I have a View, in that i want to add two UITableView as subView of that View..
monthTableViewdayTableView.both tableView frame size is parent view size.
but only one table will visible at a time. Example:
i need a method so when ever i called that method need to check which table view currently visible through flag variable.
if (visibleTable == monthTableView)
{
//need to add subview of parent view is dayTableView
[self addSubview:dayTableView];
}
if (visibleTable == dayTableView)
{
//need to add subview of parent view is monthTableView.
[self addSubview:monthTableView];
}
how can i achieve this.. kindly guide me. thanks in advance...
In table view delegate methods, you will see a parameter tableView which is nothing but your current tableView. You can use that to distinguish between your tableViews.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(tableView == monthTableView)
{
//code for monthTableView
}
else if(tableView == dayTableView)
{
//code for dayTableView
}
//extra coding
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With