UIButton on left side of screen (in iOS 7 navigation slide area) not highlighted - ios

I have a UIButton on the far left of a view controller (on a XIB), of say 100 points wide.
If the view controller is on a regular tab (i.e. not pushed on navigation stack) the button highlights as expected when tapped.
However, when the view controller is on a More-tab (so pushed on the navigation stack), the button is not highlighted when tapped on its left side (say the left most 50 points). The button does function, it's action is being called. But, when tapped on the right side it does highlight. (BTW, I think this is a general issue when the view controller is pushed from any other view controller; does probably not have to be More tab.)
After some research it turns out it's when I tap in the left screen area with which you can iOS-7-slide back to the parent view. Any ideas why this is, and how to make the button work properly again.
Thanks for your time!

I can confirm this bug with almost no code at all. All you need is an image file to serve as the background image. In the storyboard set this up:
Navigation Controller -> (root view controller) ViewController -> Button -> push segue... ->
ViewController2 -> Button
Put the second button up against the left side of its containing view (ViewController2's view) and set the image file as its highlighted background image.
Now run the app and tap the first button, to summon the second view controller's view. Tap the button at its right side: the highlighted background image appears. Now tap the button at its left side: the highlight background image does not appear, but the button is in fact receiving the tap (you can confirm that by giving it an action method that logs).
So, I would say you've got yourself a legitimate bug and you should report it to Apple. I'm certainly going to!

Unless you require the iOS 7 swipe-to-pop gesture, you can fix this bug by disabling that gesture recognizer:
self.navigationController.interactivePopGestureRecognizer.enabled = NO;

Related

Swift - create a back button without navigation controller

I have an app that has a toolbar, but I don't want the bar at the top, in order to free more viewing space. Therefore I have decided not to use a navigation controller. I'd like to add a back button to the toolbar. How would I go about this?
Adding the button is easy enough, and setting the action to performSegueWithIdentifier is all fine, but what happens is that the previous view just gets loaded again, rather than show it as it was, like a true back button. So if I tap on the 10th row on a tableView and go to a new page, when I press the back button it loads the view from the top again, instead of showing it as where I scrolled down to last.
Even though you don't want a UINavigationBar, you do want a UINavigationController in this case, because it manages the 'back stack' exactly the way you want it. Just hide its navigation bar by setting its navigationBarHidden property to true (in the Storyboard or in the viewDidLoad function of the root view controller).
You can then use navigationController.popViewController(true) as normal, in response to the user clicking your custom back button.

Handle touch of button residing in parent view controller, ios

What would be the best way to handle user touch for the middle button? (UIImageView positioned over tab bar). The image/button is currently a property of the UITabBarController, which in turn contains two subview-controller pairs (Item #1 and #2). The user should navigate away from the tab bar controller upon touching this button (its not a tab).
Thanks! :)
Make an IBAction in your UITabBarController subclass. Whatever is supposed to happen when the button is tapped can be put there.

How to manually add a Back button to my NavigationBar?

I would like to know how I can add a back button to my UINavigationBar, I know that If I embed in a Navigation Controller in my main view, that all of this would happen automatically, but that is not what I am trying to do, in fact, the back button could go to any other view I connect the segue to, doesn't even have to be the back.
The back button needs to be the system navigation "back" button, I don't want to have to set image files for my buttons.
I tried dragging in a bar button item in storyboard but nothing shows up, doesn't seem to be doing the trick. The navigation bar was dragged to the view in storyboard (not created programmatically) and it shows up just fine.
I looked at the following similarly asked questions:
-> How do i add a 'back' button to a UINavigationBar manually?
-> How to add a button to UINavigationBar?
-> How to programmatically add a UINavigationBar and a back button on it
but they all point to just embedding the view in a navigation controller, which again, is not what I am trying to do.
If someone can please help me out, provide some sample code I would greatly appreciate it.
Try drag-drop a UIButton object. I have always added manual back button (hardly took the in-built one)

Embedded UINavigationController's back button does not work

I'm using a Container View control through interface builder to embedded a UINavigationController and its stack into my app.
The problem I'm having is that the back button does not work on all pushed VCs over the Root VC.
You press the automatically generated back button on these pushed VCs and nothing happens.
Edit:
There is no code written. Its all set up in IB at the moment.
As you can see...Container View with its embedded view controller set to the UInavigation Controller. The whitespace on the left will be a swipeable menu eventually - thats the reason for the set up. Then there's a next button on the root RV which segues to a second view controller.
That state is shown above. Pressing the back button (labelled test) does nothing. Normally it would pop the top view controller and go back to 'test'. Clearly the embedding is interfering with the normal UINavigiationController function somehow.
I just dont know how.
Another Edit:
Making a custom button on that top View Controller and manually calling
[self.navigationController popViewControllerAnimated:true];
Actually works and the top view controller is removed from the stack.
So the question is why does the back button not work?
I had a similar problem when I forgot that I added a tap gesture recognizer to my navigation bar. The back button actually received touches (pushed state) but as in your example did nothing. A custom button on the navigation bar worked though.
Once I removed the gesture recognizer the back button worked again.
Maybe some other view/or gesture recognizer in your container view is catching the touches...

Tabbar not showing in ios application

i am making one iOS tabbar application in that i have put 4 different tabs and whenever i click on 1 st tab and load another view after clicking of the first tab. After that when i press back button then tabbar is not displaying .So that i want hint that how can i show that
back the tabbar when we move from one tab from another and yes how i can use consistent the tabbar in whole application can you just guys help me on this i am new to iOS development.
here i am put the screen shot ...
here first screen is this one..
when i tap the video button that are first in the view then another window open
which are as under and see the tabbar is not there...
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Looking at your screen snapshots, do I correctly assume you're attempting to transition to the "Videos" scene by touching the big "Videos" button in the center of the "Home" scene (rather than touching the tab bar button at the bottom of the screen, which I assume works fine)? If that's the case, you need to have your button tell the view controller's tab bar controller that you want to change the index of the tab bar, and it takes care of it for you. You cannot do the transition using a segue (or at least not without a custom segue, which is even more complicated than the procedure I outline below). If you're changing the view some other way (e.g. using a standard segue or using presentViewController, pushViewController programmatically, etc.), your tab bar can disappear on you.
You later said:
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Yes, that's true. You cannot use a segue from one of your big buttons to one of the tabs in your tab bar. (Or technically, if you wanted to use a segue, it would be a custom segue which would do something very much like my below code, though perhaps a tad more complicated.) So, rather than using a segue for your big button, you need to write an IBAction (connected to the big Videos button on the Home scene), that tells the tab bar to change its selection:
- (IBAction)clickedVideosButton:(id)sender
{
[self.tabBarController setSelectedIndex:1];
}
A couple of comments:
My answer was predicated on the assumption that your tab bar works as expected when you tap on the buttons of the tab bar, itself. If you tap the buttons at the bottom of the screen, do you transition to your other views correctly and preserve the tab bar? If so, my answer above should solve your issues in getting the big buttons to work. If not, though, then the problem rests elsewhere and you need to show us your code that might account for that (either you're something non-standard in the UITabBarControllerDelegate methods, or your viewDidLoad of the view is doing something nonstandard).
If I understand your user interface design right, you have the tab bar at the bottom as well as the big buttons in the middle, which presumably do the same thing. That is, no offense, a curious user interface design (duplicative buttons, requiring extra tap on a button, etc.). You might want to choose to either use either big buttons (in which you can retire the tab bar, eliminate the IBAction code I've provided above, and just use a nice simple navigation controller and push segues, for example), or just use the tab bar (and lose the home screen, lose the big buttons, etc.).
You also made reference to "press back button", and I don't see any "back" button on any of your screen snapshots. Do I infer that you have a navigation controller and you're doing a pushViewController or push segue somewhere? If you're doing something with back buttons, you might need to clarify your question further.

Resources