Two taps required to make hidden UINavigationBar appear - ios

I have a UITableViewController which contains cells of different languages. When the user taps a cell, they are taken to a UIPageViewController which shows the appropriate leaflet in that language. That part is working well.
I have implemented the use of the following code to make the UINavigationBar hidden and to appear on a tap:
self.navigationController.navigationBar.hidden = YES;
self.navigationController.hidesBarsOnTap = true;
I have that code in my viewDidLoad. I don't have any gesture recognisers, but both on the Simulator and on the device, to get the UINavigationBar to appear, I have to tap the screen twice. Why do I have to tap twice?
If I do the same on a UITableViewController, I only have to tap once, so it seems something specific about this UIPageViewController and I can't quite figure out what.
I've looked around and I can't seem to find anyone with anything similar.
On guidance on this would be appreciated.

Try this :
[self.navigationController setNavigationBarHidden:YES animated:YES];
If that does not work, can you post the code for your methods relevent to this issue?
Could probably help more with more info.

Related

The slide-back of UINavigationViewController doesn't work

In iOS 7 Apple add new default navigation behavior.
You can swipe from left border of the screen to go back on navigation stack.
But in my test project, this behavior seems doesn't work. I've check it for many times and tried the following blog
http://keighl.com/post/ios7-interactive-pop-gesture-custom-back-button/
UPDATE
Actually it works, but I have to swipe from the very left of the screen, so I made a mistake, can we optimize it?
Add this code in your Appdelegate.m file and pop gesture will work in your whole application. Also add the UIGestureRecognizerDelegate in your Appdelegate.h file.
self.navigationController.interactivePopGestureRecognizer.delegate = self;
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
Swipe from the very left end of the screen, only then the pop gesture will work
You haven't write any code in your project and
for navigation behaviour you must add UINavigationController to your project.
please put proper link or proper code here.
Were you using the simulator? its harder to do there than on real devices.
I wouldn't recommend changing how this gesture works, it should be uniform between apps to be useful.

Loading controller on top of view from storyboard (or nib if necessary)

I've seen lots of topics about this but i could not get this to work as i wanted, i'm sorry that this will look like a duplicate.
What i'm tyring to do :
Show a view from a storyboard VC (or a .xib, it's really up to what's "best") as if it was an alert. The user has to interact with it and then dismiss it.
Here is what i have :
A viewcontroller in my storyboard ; its linked to the corresponding .h and .m files and everything works fine on that side.
Note : That viewcontroller is "alone", there is no segue leading to it.
Now i'm in my active VC from my app flow, and i'm doing this :
ADFViewController *adf = [[ADFViewController alloc]initWithNibName:#"ADFView" bundle:[NSBundle mainBundle]];
adf.xxx = yyy // just setting some data that the user interacts with.
[self.view addSubview:adf.view];
(The VC has a button that does [self.view removeFromSuperview]; to dismiss itself when the user decides to do so.)
I've also tried using this :
adf = [self.storyboard instantiateViewControllerWithIdentifier:#"ADFViewController"];
Both don't work or "almost" work.
They're linked like they should, the storyboard and Nib name corresponds (i've tried both).
As a result I just get a blank screen. The view size is 300x300 so It should at least appear somewhat on my screen. But all i get is a blank screen (the view background).
When that is working, I intend to make the background transparent so it really looks like an alert but i'm not even up to that point. And maybe i'm struggling even though i'm going in the wrong direction.
Questions :
Am i doing something wrong?
Is this the right way of achieving this?
What should I do?
Thanks a lot for your time.
Getting a view to look and behave like an alert (with the transparent background, etc.) takes some work because you can't subclass UIAlertView. I would recommend using an already-built customizable UIAlertView-looking dialogue. There are a couple listed on this question:
UIAlertView addSubview in iOS7
These basically just take a view as input, so you can just pass in your view controller's view and everything else will be taken care of for you.

iOS Navigation Controller Background Glitch

OK, Ive looked everywhere for an answer, and I am unsure of what you may call this by a name - but I have detailed what my issue is below.
In my main.storyboard file, I have a view as a child from a navigation controller (i.e., allowing nav bar navigation) - being a MKMapView, which when you tap on a pin, it brings up the next scene.. This is all as it should be... (lets call it the "map" and the "detail" scene)
BUT!!!
When you hit the back button, the map view glitches and overlays the detail views background image over the mkmapview for about half a second. Would anyone be able to suggest what this problem is? Thanks soo much!
Due to stack overflow, I can't upload a picture just yet (reputation).. are you allowed to link externally?
Your help is very much appreciated.
EDIT: Ive uploaded a screenshot: http://tinypic.com/r/e19gtx/8
Try
self.view.backgroundColor = [UIColor whiteColor];
in ViewDidLoad.
Basically make sure your glitchy view has a background colour.
Did you use segue? Try manually pusing the "detail" view controller onto the map using
[self.navigationController pushViewController:#yourDetailViewController# animated:YES]
hope this works, i encountered this before.

IOS7: Pop ViewController forces the UIImageView to drop

After upgrading my project to iOS7
when I do a BACK Button and the UINavigationController goes back to the previous page, an ImageView on the top of the screen shifts down.
I use IB to do my layouts. These are my Simulated Metrics:
I have AutoLayout off. Any ideas on what the issue might be? I wasnt sure if anyone wants to see specific code and I didnt want to clutter up the question with too much code.
Updates: Based on the comment questions, I wanted to make these updates:
In no place in the application .h or .m file do I make any changes to the imageview's sizes or location.
In both the viewDidLoad and viewDidAppear I call a user-defined method called recalculateAll but their is no reference at all to any imageview sizes. Just for trying it out I commented out the entire section and ran the code and it still jumps down.
In my init I do programatically set some imageviews (you see the #132 in what appears to be a bubble) using their x and y's.
Here is a typical navigation I use for moving from the view controller to the tableviewcontroller:
GetTimeOffByType *showTimeOffReport = [[GetTimeOffByType alloc] initWithNibName:#"GetTimeOffByType" bundle:nil];
showTimeOffReport.timeOffType = #"Vacation";
[self.navigationController pushViewController:showTimeOffReport animated:YES];
These are all .xib files, no storyboarding at all. Its basically a view controller which has an embedded UINavigationController with 6 buttons. Each time a button is pressed it pushes a UITableViewController passing different parameters and showing different data. The transition I am using to get back to the original UIViewController is simply the iOS generated BACK button (so no code to show for that)
Update#2 Hopefully this will help someone solve this wierd behavior. So if I were to click on the table view cell on showTimeOffReport to get the cell detail and then using BACK navigate all the way back it doesnt jump down.
Update#3 Ok this is something I just discovered : The issue of jumping down or not is related to the translucency of the UINavigationBar. If you have a Translucent = YES it will start from the top of the window. If you have a translucent = NO it will start from the bottom of the UINavigationBar.
You might try setting the new property on UIViewController edgesForExtendedLayout to UIRectEdgeNone.
Here is a good resource that explains more about how view layouts changed in iOS 7.
See Apple Documentation
If you plan to be backwards compatible you will probably need to do some runtime checks and adjust positioning if the device is not running iOS 7.
This might help you..You can try adding UIViewControllerBasedStatusBarAppearance key and set it's value NO in your info.plist
UIViewControllerBasedStatusBarAppearance = NO

hide keyboard in secondary viewcontrollers when pressing background storyboard

I've been scourging the internet and saw several promising answers but none that worked for me. The problem I have is that I have many ViewControllers that I placed in Storyboard mode.
Lets say in my 5th view controller I have some TextViews and TextFields that pops up a keyboard for user input when pressed. However I want to be able to hide the keyboard when I press the background.
I tried following the first and second responses here: How to dismiss number pad keyboard by tapping anywhere
But I dont think my set up is exactly the same as theirs.
Can someone please help me? Please be VERY SPECIFIC if possible and dont assume I know how to fill in the dots.
Thanks so much!!
edit. sorry for not being clear but I meant I want the app to dismiss the keyboard when the user presses anywhere on the screen (thats not another Text field/view). The link I show does this but my problem is that I am storyboarding so I have multiple UIViewControllers and I'm not sure how to get IBOutlets/IBActions to work for the "secondary" viewcontrollers. They only show up under the first/main one...
In your application delegate file,
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[self.window endEditing:YES];
}
you can use [self.view endEditing:YES];
have a look at the Apple docs for Ending a View Editing Session

Resources