iOS UISearchBar not showing keyboard on first tap - iphone

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.

Related

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:

UISearchDisplayController overlay positioning

I'm having a bit of difficulty with UISearchDisplayController and the positioning of it's grey overlay when building against iOS 7. This was working fine when building against iOS 6, but only seems to have
I have a UIView built into a base ViewController which needs to be shown on every page (reads "Hello thereAnother String") in the screenshot before. When I navigate to my view controller which includes the UISearchDisplayController, this is what I see:
This is fine and is what I'd expect to see. However, when I try to click on the view UISearchBar, this is what I see:
Note that the grey overlay is offset by the size of that UIView that I need to put in all screens of the application.
Any ideas on why this might be happening?
can you use custom category of UITextfield and override those Method the
- (CGRect)textRectForBounds:(CGRect)bounds; and
- (CGRect)editingRectForBounds:(CGRect)bounds ;
this problem occur from custome this method.

SearchBar / SearchDisplayController in Container overlays UITableView - iOS 7

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.

UIPickerView Causing Crash in iOS4

I have a simple tabbar app. Built directly from the tabbar template. As I test the app, I notice that the app sometimes crash. After pinpointing the right sequence, I found out that the app will crash if I do this:
Run app. Open the view that has a UIPickerView on it.
Open another view.
Tap home button (this will send the app to background).
Tap the app icon again to bring it at the front.
Tap the view that has the UIPickerView in it.
Crash!
Checking the console shows:
-[UIPickerView setFrame:]: invalid height value 130.0 pinned to 162.0
The UIPickerView I use is a custom size. I use transform of scale 0.8f on the height. So if you calculate 0.8*162.0 is indeed 129.9f (130 as mentioned by the console).
I have no idea how to fix this. Any ideas?
The problem is solved. It seems when the app goes to the background, UIPickerView needs to find its components resources again. It is not about sizing of UIPickerView at all.
I used images for the UIPickerView components, so after I populate the UIPickerView with these images, I released all the images that were allocated earlier. These images must not be released if it were to work in iOS4.
Only release them when the app ends.
Your problem has been fixed by another guy with a radical approach. See this post'sanswer provided by a guy named bhavinb.

UISearchBar Animation

It's common to see a UISearchBar in an application, that upon a click, will enlarge and animate into view with a keyboard. I'm curious, is this something the iPhone SDK provides for free, or is the Animation code more than likely written by the developer? I use a UISearchBar in several controllers, however by default a keyboard just pops into view, the search bar does not animate in any fashion. This is also very prominent in apps that have a search icon. How is it typically done?
This can be easily implemented using the UISearchDisplayController using the iPhone SDK 3.0 and above.
See the TableSearch example project, included in the SDK.
There is a discussion "UISearchBar like Contacts" on this at the apple site.
Did you put it in through Interface Builder or programatically? Because by default the keyboard animation should play.