SearchBar / SearchDisplayController in Container overlays UITableView - iOS 7 - iphone

this is my first question on stack overflow. I hope I will get some help :)
I'm currently updating my App to iOS 7 and I'm experiencing some problems when having a SearchDisplayController inside a ContainerView. Actually it looks like the following:
http://cl.ly/image/2Q1d0D0O1K0u
The whole content with the search bar is placed above the previous ViewController as a ChildViewController. It is it's complete own TableViewController. Now when I tap on the search bar it looks really strange with a weird animation:
http://cl.ly/image/1W2m3c1t3340
Even if I try to build this completely in storyboard (Add TableViewController, Add Container With TableViewController inside) I experience the exact same behaviour, without writing any line of code. I'm messing around with this issue for two days now and I'm not having a clue. Probably this is an iOS 7 bug? Using iOS 6 it works flawlessly.

Got it working using the following code:
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
Odd that I read about that a ton of the time in case when the search bar overlaps the status bar. Don't know why I didn't try this earlier.

Related

Gap between UIView containing table view and tab bar

I am experiencing a UI issue since iOS 15 where there is a gap between the tab bar and my UIView(UIViewController's view).
I tried to hide the toolbar as advised from several posts but this is still not working.
For more details, I created a mockup of the actual issue.
I have already set the tableView.sectionFooterHeight to zero which has therefore diminish the space but there is still a gap.
I am unsure what should be done next as no other solution has been found yet.
Your help or advise will be greatly appreciated.
I solved this issue.
Thanks to this post: UINavigationController as a child of UITabBarController leaves a gap
Basically, I added those settings in the ViewControllerOne:
edgesForExtendedLayout = UIRectEdge.Bottom
extendedLayoutIncludesOpaqueBars = true

Adding ViewController's View as subview to UIPageViewController in iOS 8 gives weird UINavigationBar while show/hide

I have been working on a project where I needed to show list of images with zoom / swipe feature as presented view modal. I created custom ImageViewer using ContainerView in which I have added UIPageViewController. And on demand, I added ImageViews over the UIPageViewcontroller's view. When user taps to imageView, the top UINavigation gets shown and hidden on toggle basis.
Everything worked as expected in iOS 7.1 and less. However when I tested the functionality in iOS 8 devices and simulator, the ImageViews were not added to UIPageViewController in TopLeft ( beneath UINavigationBar ). It is added below the NavigationBar as shown in bug_iOS_8.png below.
Once I touch the buggy view, it repositions itself to correct position as in image expected.png below.
I have created and tested the issue in sample project and it seems it is bug in iOS 8 itself with UIPageViewController. I went through couple of questions regarding weird behavior of UIPageViewController too. Please check the sample app here and kindly let me know if anyone has any hints on what is going on.
Thank you for your time and help.
PS: BTW I am using following version of Xcode.
Update 1:
I have tried as per the pin suggestions. However, the problem aligning is with the main view of UIViewController rather than its subview. In below image, Yellow is main View of UIViewController and red one is added subview, I added pin to "red" on in reference to superview "yellow" one. Please check following screen shots.
On startup.
After touch on screen.
Kind Regards,
check in storyboard for particular viewController and make sure Extended Edges >> Under top bars is not selected.
I had a very similar issue and the way i fixed it was select the view being added to the UIPageViewController in the storyboard and selected the pin options. Below in the image you can see the Constrain to margins options, make sure you unselect that. Also when choosing what view to pin it to make sure you select the superview and not the Top Layout Guide.
Curious are you hiding your nav controller like this?
[self.navigationController setNavigationBarHidden:YES];
also if you have multiple Nav controllers, you might need to check you are referencing the correct one.
If you want it to be hidden when you present the ViewController you should move it to
-(void) ViewWillAppear{
}

GUI elements position in Xcode Storyboard differs from their position in the simulator

I recently worked with Xcode, especially with layout GUI elements. I read a lot of questions here about this, but it did not help me. What I have: ViewController, it lies ImageView, it lay all the other elements, I disable autolayout, screen size and in the simulator and in Xcode - the same (4 inches), but when I run I still see it:
What am I doing wrong, what is there is a way to what looks like a storyboard, and looked in the simulator (and real device) equally?
There might be two issues you are suffering with, please check following points for better understanding.
Check this with iOS 6 simulator. If its working fine then, you need to set ios 6/7 deltas for your subviews. Here is better explanation of it-- Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?
Check autoresizing masks of your subviews, definitely this is what affecting your views.
Good Luck!
Notice that in your Storyboard view, you have not displayed a status bar and that when running on the simulator, a status bar is shown. This is why all the objects are off placed. To fix this, you can either:
Hide the Status Bar - Call this method in your desired view controller:
- (BOOL)prefersStatusBarHidden {
return YES;
}
Show a simulated metric - Switch on the status bar simulated metric in your Storyboard:

iOS7 issue with container view

EDIT**: Although someone has decided they would like to down vote without a reason I'm going to leave this up. I noticed that in viewDidLoad of my view controller container, the content view I setup was the same size as in IB. When I later tried to load other views with my view container controller, the content view had changed it's bounds. Hope this helps anyone else that has a similar issue. The excepted answer worked. Since this is a build for iOS 6 a simple check of OS version made this an easy fix.
I have a strange issue that seems to be iOS7 related. This is an iOS6 targeted app. I have followed apples own docs about creating custom container views here. The problem I'm seeing in iOS7 is the first view I load is within the proper bounds of the content view i have defined, the other two are filling the bounds of the entire screen so it hides under the navigation bar with my segmented control. I defined the view I'm loading in a separate view controller in storyboards. Is there some sort of constraint that is working against me?
I should add that I have noticed the content view I defined in my container controller is actually changing it's size after the initial view is loaded. I'm at a loss of how to stop iOS7 from changing that UIViews frame size when it really shouldn't be changing.
Here are some screenshots. Code is pretty much the same as in the apple docs, have tried a few other ideas, defining bounds etc. but I think it has something to do with IB since the content view is changing its bounds. It appears to only be doing so in iOS7.
There is actually a proper way to fix this,
Set edgesForExtendedLayout to UIRectEdgeNone for the view under the tab bar.
Of course, I might've just looked at the pictures and assumed this was your problem...sorry if its completely unrelated..
That's a known 'issue' in iOS 7. Since you can now have a blurred look through the UINavigationBars, UITabBars, ... This also causes issues in native apps (e.g. the Photos App) or APIs.

iOS UISearchBar not showing keyboard on first tap

I have a view controller with a UISearchBar at the top and it takes two or three taps before the keyboard shows up. It does this on simulator and on device. Anyone knows what is causing this? I sometimes have this issue with UITextField too?
Thanks,
I'm developing for iPad and using Xcode 4.5 and deploying for iOS 5.0 and +
Not sure what is it that you are searching, but if it is in UITableView, you could use UISearchDisplayController - Sample here - makes it a lot easier to deal with table search.