HexBlit
HexBlit

Reputation: 1162

UISearchBar Resize issue

I am having an issue where the UISearchBar keeps resizing once i click away then goes back, to the appropriate size. I am setting the frame and the bounds like so in the init.

    [_searchBar setFrame:CGRectMake(10, 10, 300, 20)];
    [_searchBar setBounds:CGRectMake(10, 10, 300, 20)];

I am also doing this for layoutSubviews

- (void)viewDidLayoutSubviews
{

    [super viewDidLayoutSubviews];
    [_searchBar setFrame:CGRectMake(10, 10, 300, 20)];
    [_searchBar setBounds:CGRectMake(10, 10, 300, 20)];
}

Search bar keeps resizing iOS7

Upvotes: 1

Views: 81

Answers (1)

HexBlit
HexBlit

Reputation: 1162

So the real true way to solve this is to use Autolayout with visualConstraints. The searchbox no longer resized once I started to use it.

Upvotes: 1

Related Questions