在我的viewDidLoad
中,我以編程方式創建搜索欄。當點擊搜索欄時,搜索欄向右凹進。爲什麼會發生這種情況,我如何防止這種情況發生?我沒有使用自動佈局。防止UISearchBar在點擊時縮進
- (void)createSearchBar {
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.searchBar.delegate = self;
[self.searchController.searchBar sizeToFit];
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = NO;
self.definesPresentationContext = YES;
self.edgesForExtendedLayout = UIRectEdgeNone;
}
它也向上移動? – zcui93
你能解決這個問題嗎? – Harsh