Closed FedericoSub closed 6 years ago
Do you mean that when you tap on Home nothing happens?
No , when I tapped on button "Aggiungi" (on bottom side)
I'd like to open the BuddyTableViewController. https://user-images.githubusercontent.com/35109594/36415611-d34a4760-1626-11e8-80cc-5d569f0c1d21.png
On tap of button I used the same code that works un menu (tap on Amici) but nothing happens.
If you need I can attach all code..
Yes if you can, because it is very difficult to help without it.
can I drag some file in .zip here?
in ProfiloROTableViewController you can find this func that if you Tapped on circle image I'd like open BuddyTableViewController
@objc func tap(sender: UITapGestureRecognizer){
if let indexPath = self.collectionView?.indexPathForItem(at: sender.location(in: self.collectionView)) {
let num = indexPath.last
if (imgBuddyArray[num!].nome) == "Aggiungi" {
print(imgBuddyArray[num!].nome)
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let desController = mainStoryboard.instantiateViewController(withIdentifier: "BuddyTableViewController") as! BuddyTableViewController
let newFrontViewController = UINavigationController.init(rootViewController:desController)
revealViewController()?.pushMainViewController(newFrontViewController, animated: true)
}
} else {
}
}
Could you attach the project, not only the swift files? Archive the folder that contains the xcodeproj file.
can I send with wetransfer ? is too big .
can I have your email?
patrick.bodet4@wanadoo.fr
sent with wetransfer thanx
Ok, pushMainViewController is for pushing a new controller from left or right side view controller. In this case you want to replace the main view controller. Use setMainViewController instead of pushMainViewController:
@objc func tap(sender: UITapGestureRecognizer){
if let indexPath = self.collectionView?.indexPathForItem(at: sender.location(in: self.collectionView)) {
let num = indexPath.last
if (imgBuddyArray[num!].nome) == "Aggiungi" {
print(imgBuddyArray[num!].nome)
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let desController = mainStoryboard.instantiateViewController(withIdentifier: "BuddyTableViewController") as! BuddyTableViewController
let newFrontViewController = UINavigationController.init(rootViewController:desController)
// revealViewController()?.pushMainViewController(newFrontViewController, animated: true)
revealViewController()?.setMainViewController(newFrontViewController, animated: true)
}
} else {
}
}
thanks Patrik works fine now .....sorry for my stupid question :-) I'm a beginner with swift Thanks again
Ok, there is no stupid question! Most important is that it works :-)
Just last help....how can I close the menu when is open with gesture ? thanks
In MainTableViewController.swift, remove:
self.revealViewController()?.panFromLeftBorderWidth = 50
override func viewDidLoad() {
super.viewDidLoad()
// Keep a reference to this controller
let rightController = self.revealViewController()?.rightViewController as! UINavigationController
let rightTableViewController = rightController.topViewController as! MenuViewController
rightTableViewController.navMainController = self.navigationController
//
rightButton.target = self.revealViewController()
rightButton.action = #selector(PBRevealViewController.revealRightView)
self.revealViewController()?.isRightPresentViewOnTop = false
self.revealViewController()?.rightViewRevealWidth = 210
self.revealViewController()?.delegate = self
//self.revealViewController()?.panFromLeftBorderWidth = 50
self.revealViewController()?.panFromRightBorderWidth = 50
updateView()
//MARK make navbar trasparent
let bar:UINavigationBar! = self.navigationController?.navigationBar
bar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
bar.shadowImage = UIImage()
}
Other things: Don't forget to always call the superview methods:
super.viewDidDisappear(animated)
super.viewWillAppear(animated)
For example:
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
ref.removeObserver(withHandle: handle)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let user = Auth.auth().currentUser {
useridIniziale = user
let newUser = Database.database().reference().child("users").child((useridIniziale?.uid)!)
newUser.updateChildValues(["Token": Messaging.messaging().fcmToken ?? ""])
news.removeAll()
leggiDati()
tableView.reloadData()
}
}
:-) thanks
Hi I'm having trouble with code:
if let indexPath = self.collectionView?.indexPathForItem(at: sender.location(in: self.collectionView)) { let num = indexPath.last
This is for open BuddyTableViewController when I tapped un "Aggiungi"
This is BuddyTableViewController:
This VC is opened correctly from the right menu when I tapped on "Amici" using the same code above, but the first VC doesn'work
any suggest ?
thanks