1
votes

I have been using UISearchbar in my project with no problem at all in iOS7 now when i build my project using Xcode 6.0.1 and run on iOS8 the width of UISearchBar automatically changes for example

  • If my app is in landscape mode (iPad) and the search bar was in center and had 200 points then this width changes to full 1024 automatically.

I am not using auto layout, when i enable auto layout the issue is solved but whatever i do to change the frame in code nothing happens.

I don't want to enable autoLayout, how can i solve this problem?

1

1 Answers

4
votes

I solved this problem by using following code

-(void)viewWillLayoutSubviews
{
    searchbar.frame = CGRectMake(365, 0, 274, 44);
}

Hope this help someone