The home page of my app has UIButtons
, btnIncome
and btnExpense
. Pressing on this buttons pushes IncomeVC
and ExpenseVC
respectevely,which are two UIViewControllers
with UITabBar
added via xib. The tabBar have 4 items. Selecting on each tab item adds same four view controllers(which contains UITableViews
) as the subview of IncomeVC
and ExpenseVC
,like for eg, DailyVC,WeeklyVC,MonthlyVC,YearlyVC.(ie,for Income ,there is daily,weekly etc and same for Expense) (I have done like that because the IncomeVC
and ExpenseVC
have a UIButton
and a UIView
which is common for all tabs).
So the problem is that, if click the btnIncome
I have to populate those tableviews with the arrays related to Income and vice versa for Expense. How can I find from which viewController I selected the different tabs(I need to get it from the 4 Views I added as the subview of IncomeVC and ExpenseVC). Do I have to make 8 different views 4 each for Income and expense ?
Thanx.
You can get the previous viewController like following code,
NSLog(@"%@",[self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-2]);
This will displays the previous viewController name...