Search code examples
iphoneios6ios7uisearchbar

Background Image of Search bar is looking weird in iOS7 but looking fine in iOS 6


Hi I have installed my app in iOS 7 and I found a weird look of UISearchBar. In iOS 6.x the UISearchBar looking fine. No issue. I am attaching my search bar images with this ques. please direct me what is wrong in my implementation. Have apple deprecated or add something? I am stuck off but did not get any solution yet. I have read the UI Transition Guide also for iOS7 but everything in vain.

Image for iOS 6:

Image for iOS 6

Image for iOS 7

Image for iOS 7

Edit:

And i am setting background Image of UISearchBar in my viewDidLoad: method.

contactsSearchBar.backgroundImage=[[UIImage imageNamed:@"strip"] resizableImageWithCapInsets: UIEdgeInsetsMake(0.2,0,0.2,0)];

Please help me.


Solution

  • I solved this issue. I have just change the resizableImageWithCapInsets: method of UIImage with resizableImageWithCapInsets:resizingMode:

    contactsSearchBar.backgroundImage=[[UIImage imageNamed:@"strip"] resizableImageWithCapInsets: UIEdgeInsetsMake(0.2,0,0.2,0) resizingMode: UIImageResizingModeStretch];
    

    Dont know why this is working on iOS7. before iOS7 my implementation as asked in question is working fine. But thing is now its solved.Its late but I am happy.

    Enjoy Coding..!!