Scene reproduction
1, customize a storyboard:
Open Xcode, press Cmd+n, create a new storyboard--->next
Name the newly created storyboard: Testviewcontroller--->create
Add a label to the Testviewcontroller.storyboard whose text is: Hello-ios
2, write the UIButton uicontroleventtouchupinside event:
-(Ibaction) Btnclick: (ID) sender { // Create load Storyboard Uistoryboard * Storyboard = [Uistoryboard storyboardwithname:@ "testviewcontroller" Bundle:nil]; // Associate Controller to storyboard _viewofstoryboard = [Storyboard Instantiateinitialviewcontroller]; = [Uicolor whitecolor]; [Self Dismissviewcontrolleranimated:yes completion:nil]; [Self Presentviewcontroller:_viewofstoryboard animated:yes completion:nil];}
The following operations are run:
The following problems were encountered in loading the custom storyboard interface
Error reason: The application view presents an empty mode view controller to the target, which simply says that the view controller in storyboard is empty.
3. Solution:
- The relevant answers are given on the StackOverflow (The following is a personal translation, as indicated by the error)
Check The identifier of the Viewcontroller, if it is the same, then mentioned in storyboard.
- Check the identifier on the Viewcontroller to make sure it is unique on the storyboard.
Make sure this your buddiesorfacebook is not nil. Set a breakpoint on this line and on the debug area at the bottom see whether the object was not nil. If It is nil then problem lies in the storyboard connection.
- Make sure that your buddies or Facebook (which is not understood) is not empty. You can set breakpoints for debugging, and if the object is empty, then there is a problem with the storyboard connection.
If your current viewcontroller are not launched from storyboard then get Storyboard object like this:
If the current Viewcontroller does not start loading, you can refer to the following standard notation:
Uistoryboard *storyboard = [Uistoryboard storyboardwithname:@ "mainstoryboard"* Buddiesorfacebook = [Storyboard instantiateviewcontrollerwithidentifier:@ "buddiesfbfriends " ] ; [Self Presentviewcontroller:buddiesorfacebook animated:yes completion:nil];
The solution above did not solve my problem, so I took a second set of solutions.
To open the Testviewcontroller.storyboard view, proceed as follows:
Check the is Initial View Controller to ensure that Viewcontroller is initialized.
4, Results:
Last run correctly, such as:
Application tried to present a nil modal view controller on target ' Current View controller ' solution