I am working on IPad application. As per requirement On detail page of SplitviewController I am adding one customized UIBarButtonItem leftbar button on navigation bar.
Now in Portrait mode when I click this button I am getting following error
Terminating app due to uncaught
exception
'NSInvalidArgumentException', reason:
'Popovers cannot be presented from a
UIBarButtonItem that is not in a
toolbar or navigation bar already.'
Can one please help on this ????
Thanks,
Sagar
You most likely didn't declare your UIButtonItem variable correctly. Make sure it matches everywhere throughout your code.
For more info check out my blog post.
Related
I am trying to create a custom UITabBarController that instead of showing a "more" view controller, I want my tabs to be scrollable. I've already created a custom UITabBar with a collectionView with my tabs and it works great.
However when I add more than 5 tabs, the more navigation controller comes into play. I need that to be my custom Navigation Controller that allows the NavigationBar and the TabBar to hide themselves as the user scrolls, however, since the default MoreNavigationController is a normal UINavigationController, the desired behaviour does not occur. I've tried embedding my ViewController in my custom NavigationController before adding it to the TabBarController, but (as expected) since the MoreNavigationController is already managing all the ViewControllers after the 5th, it has no effect.
I've tried overriding UITabBarController's var moreNavigationController: UINavigationController and return my custom NavigationController. However, when I run my app it crashes with the following message:
-[MyApp.ScrollingNavController setMoreViewControllers:]: unrecognized selector sent to instance 0x7ffbce831000
2018-05-23 13:45:27.573611+0300 MyApp[6000:190109] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyApp.ScrollingNavController setMoreViewControllers:]: unrecognized selector sent to instance 0x7ffbce831000'
I do not know how to overcome this problem, so if anyone has any ideas, please let me know. Thank you!
I have a tabbar ios application. I put (embed) NavigationController in one of the viewcontroller,then added one button and one new viewcontroller to pass. I dragged from button in first vc to new vc and select "push".
But following error message is thrown when I tab the button :
Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
I really don't understand because I have already a navigation controller and also not added any additional code yet.
Thanks for any help.
You may not use push segue with a button that you have created yourself. Try using Modal segue instead.
I just created a calculator app with storyboards using two views. I started my simulator, and everything worked fine at first. On the first screen, I was able to use the "Calculator" button to switch to the second screen, and on the second screen I had a button to go back to the main menu. But when I switched from the main menu back to the calculator a second time, the app crashed, and the following error occurred:
2013-02-21 20:55:36.556 CTS Calculator[22637:c07] * Terminating app
due to uncaught exception 'NSGenericException', reason: 'Could not
find a navigation controller for segue 'To Calculator'. Push segues
can only be used when the source controller is managed by an instance
of UINavigationController.'
* First throw call stack: (0x15a9012 0x12b6e7e 0x650f31 0x642b99 0x642c14 0x12ca705 0x1fe2c0 0x1fe258 0x2bf021 0x2bf57f 0x2be6e8
0x22dcef 0x22df02 0x20bd4a 0x1fd698 0x260bdf9 0x260bad0 0x151ebf5
0x151e962 0x154fbb6 0x154ef44 0x154ee1b 0x260a7e3 0x260a668 0x1faffc
0x1ecd 0x1df5) libc++abi.dylib: terminate called throwing an exception
(lldb)
I am not sure why this did not happen the first time I pushed the calculator button. I have a custom segue transition going back to the menu, but not from the menu to the calculator. My navigation controller is set up fine, I believe. Any ideas what the problem might be?
Error shows you dont have a navigation controller. and you are setting segue style to push. Change the segue style to modal and give a try.
Yes. You can use push then the root view controller should be a navigation controller.
Check these links
Adding a Navigation Controller to a Storyboard
Use Storyboards to Build Navigation Controller and Table View
I started my app with the "master-detail" template. I simply added two other VCs and changed the "initial view controller" checkbox to "Safety Culture MainVC"...when I run, my app crashes...
What do I need to do?!
This is a screenshot of the default storyboard with my two other VCs thrown in--they work when the "Navigation Controller" is the default.
Clearly, I'm a beginner, so as much detail as you can give me is helpful!!
Thanks!
Debug Output:
2012-06-07 10:38:42.812 SafetyCulture[1020:fb03] -[safetyCultureMainVC
topViewController]: unrecognized selector sent to instance 0x6b7c210
2012-06-07 10:38:42.840 SafetyCulture[1020:fb03] * Terminating app
due to uncaught exception 'NSInvalidArgumentException', reason:
'-[safetyCultureMainVC topViewController]: unrecognized selector sent
to instance 0x6b7c210'
* First throw call stack: (0x16ae022 0x183fcd6 0x16afcbd 0x1614ed0 0x1614cb2 0x2619 0x17386 0x18274 0x27183 0x27c38 0x1b634 0x1598ef5
0x1682195 0x15e6ff2 0x15e58da 0x15e4d84 0x15e4c9b 0x17c65 0x19626
0x22ed 0x2255) terminate called throwing an exception(lldb)
topViewControlleris a method of a UINavigationController. You app tries to call this method and since it is not there it crashed.
In your image your entry point arrow is still on the navigation controller:
Move it via drag&drop to your safetyCultureMainVClike this:
Your Initial View Controller needs to be embedded in something when you are in a storyboard. For example, tab bar controller, navigation controller...
Judging from your workflow you posted, all your controllers should be part of the same navigation controller. Starts with Safety Culture, then goes one of two paths depending on which button is pushed.
It should look like this:
For me, it was that I was doofishly accessing variables that were not set in my ViewDidLoad. This new view was previously hooked up to a segue from another view, which had set the variables.
I have a following application structure:
Tabs - Tab1 - 5. On on of the Tabs I have a navigation view and instead of having a tableview like in following tutorial:
http://broadcast.oreilly.com/2009/06/tab-bars-and-navigation-bars-t.html
I would like to have buttons on a page instead of a table view just like in this tutorial:
http://fuelyourcoding.com/iphone-view-switching-tutorial/
I built the application and all the views but when I click on the button to move to the next view it crashes and I get following error message in the debugger console.
...Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView copyWithZone:]: unrecognized selector sent to instance 0x5d207b0'
... Call stack at first throw:
When just having a UINav. with buttons it works fine and the UITab works fine but together it crashes as soon as you click the button on the page. I even used a IBAction which just wrote a message into the log (NSLog) so I just cannot seem to figure out where the main issue is?
Well, it's an old question and I suppose it is already solved, but I encountered that same problem today... And I hope it may be useful to somebody.
This is just a mistake with an association of a Connection in the Interface Builder, you may have changed an outlet's name programmatically and the connection is still associated with the old name in the Interface Builder.
Solution: Go to IB and update the Connections of the affected View Controller.