Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

495
Views
Swift 4: cómo anular la barra de pestañas abrirá el controlador de vista

¿Es posible que cuando un usuario haga clic en un elemento de la barra de pestañas, pueda anularlo en UITabBarController , donde luego verifico un UserDefault que luego decide si muestro la vista o return y permanecen en su vista actual?

Sería algo como esto:

 override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { if item.image == UIImage(named: "TabProfile") { // Profile tab selected if !loginController.isUserLogged() { // Not logged in... showLoginView() // Following line doesn't work... tabBarController?.selectedIndex = selectedIndex } } }

Si es posible, quiero realizar esta verificación y, si es false , evitar que la vista llegue incluso a viewDidLoad .

Gracias.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Supongo que necesitas

 func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { if let ind = tabBarController.viewControllers!.index(of:viewController) , ind == 2 { // suppose profile is 2 // if userNotLogged { // present modal login view return false } } return true }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!