IOS7 question with text add-on to UISearchBar placeholder

Hi, this is a weird behavior when aligning the text of a UISearchBar while the UISearchBar not in editable mode, but which works fine in edit mode. In non-editing mode, in which the position of the placeholder text is not used as the center, this text display is bit-up inside to UISearchBar , as shown below.

Replacing a non-editable mode is as follows:

enter image description here

Recording editing mode is as follows:

enter image description here

As you can see, the first screenshot showing bit by bit is not like the second screenshot of Center. Therefore, I want to make this place the Holder text center as the search icon Y.

I just set the text in the Bar Barholder search bar using the main method:

  [self.srcbar setPlaceholder:@"Please Enter search Text"]; 

Please help me with this, how can I fix this problem.

+8
placeholder ios ios7 uisearchbar
source share
1 answer

What you described is technically the standard behavior for the search bar. If you want the text to shift a bit when editing, you can adjust the search bar offset in Interface Builder. I included an xcode screen shot and a simulator to show you the difference at runtime. See image here: enter image description here .

0
source share

All Articles