I have a tab bar controller which has two items connected to two view controllers(say A & B) now I want to add a 3rd view controller (say C). But I don't want to add a third icon in tab view. When the user select the second icon it should render B or C depending on whether user has signed in or not.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
- Is there a Github markdown language identifier for
Just create another view controller for the tab bar item for which you want to display different views depending on the context. Let's call it
RouterViewController
. Then pass the information you need to decide which view controller to show to thatRouterViewController
and implement the necessary logic there.From the
RouterViewController
you can now present whatever view controller you want (without animation). There are plenty of ways to do this, for example:RouterViewController
a subclass ofUINavigationController
and dynamically set itsrootViewController
property.RouterViewController
a container view controller and embed the desired view controller accordingly.RouterViewController
. (I personally would discourage this option because presenting modal view controllers is intended for another purpose.)etc.