My problem is that I was looking for way to use both storyboard and xib. But I can't find proper way to load and show storyboard programmatically. Project was started developing with xib, and now it's very hard to nest all xib files in storyboard. So I was looking a way to do it in code, like with alloc, init, push
for viewControllers. In my case I have only one controller in storyboard: UITableViewController
, which has static cells with some content I want to show. If anyone knows proper way to work both with xib and storyboard without huge refactoring, I will appreciate for any help.
相关问题
- CALayer - backgroundColor flipped?
- 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
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
in swift
NavigationController and pushController you can replace for
In attribute inspector give the identifier for that view controller and the below code works for me
For swift 3 and 4, you can do this. Good practice is set name of Storyboard equal to StoryboardID.
and then you can load your Storyboard in your ViewController like this:
}
When you create a new Storyboard just set the same name on StoryboardID and add Storyboard name in your enum "StoryBoardName"
In your storyboard go to the Attributes inspector and set the view controller's Identifier. You can then present that view controller using the following code.
Try this
Swift 3
Swift 2
Prerequisite
Assign a Storyboard ID to your view controller.
IB > Show the Identity inspector > Identity > Storyboard ID
Swift (legacy)
Edit: Swift 2 suggested in a comment by Fred A.
if you want to use without any navigationController you have to use like following :