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.
Start a segue from any object that implements an action method, such as a control or gesture recognizer. You may also start segues from table rows and collection view cells. Right-click the control or object in your current view controller. Drag the cursor to the view controller you want to present.
In Swift 3,
if let navController = self.navigationController, navController.viewControllers.count >= 2 { let viewController = navController.viewControllers[navController.viewControllers.count - 2] }
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