Issue: place parentview at top of all views, buttons, labels
public static var BottomBarVC: BottomBarViewController!
public static var parentViewHeight: CGFloat = 0
var homeVC : HomeViewController!
var favoriteVC : FavouriteItemsViewController!
var profileVC : ProfileViewController!
override func viewDidLoad() {
super.viewDidLoad()
BottomBarViewController.BottomBarVC = self
BottomBarViewController.parentViewHeight = self.parentView.frame.height
assignViewControllers()
// setScanImage()
}
func assignViewControllers() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
homeVC = storyboard.instantiateViewController(withIdentifier: "HomeViewController") as? HomeViewController
favoriteVC = storyboard.instantiateViewController(withIdentifier: "FavouriteItemsViewController") as? FavouriteItemsViewController
profileVC = storyboard.instantiateViewController(withIdentifier: "ProfileViewController") as? ProfileViewController
embedHomeVC()
}
func embedHomeVC() {
AppDelegate.embed(self.homeVC, inParent: self, inView: self.parentView)
}
@IBAction func homeButtonPressed(_ sender: Any) {
// C59104
// 9A9A9A
homeImageView.image = UIImage(named: "home_sel")
homeLabel.textColor = hexStringToUIColor(hex: "C59104")
favoriteImageView.image = UIImage(named: "favorite_unsel")
favoriteLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
shoppingImageView.image = UIImage(named: "shopping_unsel")
shoppingLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
profileImageView.image = UIImage(named: "profile_unsel")
profileLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
AppDelegate.embed(self.homeVC, inParent: self, inView: self.parentView)
}
@IBAction func favoriteButtonPressed(_ sender: Any) {
homeImageView.image = UIImage(named: "home_unsel")
homeLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
favoriteImageView.image = UIImage(named: "favorite_sel")
favoriteLabel.textColor = hexStringToUIColor(hex: "C59104")
shoppingImageView.image = UIImage(named: "shopping_unsel")
shoppingLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
profileImageView.image = UIImage(named: "profile_unsel")
profileLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
AppDelegate.embed(self.favoriteVC, inParent: self, inView: self.parentView)
}
@IBAction func shoppingButtonPressed(_ sender: Any) {
homeImageView.image = UIImage(named: "home_unsel")
homeLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
favoriteImageView.image = UIImage(named: "favorite_unsel")
favoriteLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
shoppingImageView.image = UIImage(named: "shopping_sel")
shoppingLabel.textColor = hexStringToUIColor(hex: "C59104")
profileImageView.image = UIImage(named: "profile_unsel")
profileLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
}
@IBAction func profileButtonPressed(_ sender: Any) {
homeImageView.image = UIImage(named: "home_unsel")
homeLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
favoriteImageView.image = UIImage(named: "favorite_unsel")
favoriteLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
shoppingImageView.image = UIImage(named: "shopping_unsel")
shoppingLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
profileImageView.image = UIImage(named: "profile_sel")
profileLabel.textColor = hexStringToUIColor(hex: "C59104")
AppDelegate.embed(self.profileVC, inParent: self, inView: self.parentView)
}