Search code examples
iosios7uisearchdisplaycontroller

iOS 7 UISearchDisplayController issue


Guys I am using UISearchDisplayController in my app and it was working fine in iOS 6 and 5. In iOS 7 I am getting this UI issue.enter image description here

The searchbar and the table view is going up a bit also the rows in the table are moving up more than the expected bounds. Any one facing the same issue?


Solution

  • You can try to set the property edgesForExtendedLayout of the UITableViewController to UIRectEdgeNone for iOS 7 and above to none because by default it's UIRectEdgeAll.

    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
    
    - (void)viewDidLoad 
    {
        [super viewDidLoad];
    
        if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) 
            self.edgesForExtendedLayout = UIRectEdgeNone;
    }
    

    EDIT :

    Some explication with the Apple Documentation here.