只是一個子層添加到的UISearchBar和更改視圖的背景顏色將會使動畫近乎完美
- (void) searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller {
self.view.backgroundColor = RGB(199,199,204);
self.fixSearchAnimation = [[UIView alloc] initWithFrame:CGRectMake(0, -20,320, 40)];
self.fixSearchAnimation.backgroundColor = RGB(199,199,204);
[self.searchController.searchBar addSubview:self.fixSearchAnimation];
[self.searchController.searchBar sendSubviewToBack:self.fixSearchAnimation];
}
- (void) searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller {
self.view.backgroundColor = [UIColor whiteColor];
[self.fixSearchAnimation removeFromSuperview];
}
在低速模式下,你仍然可以看到搜索欄原點子視圖和新視圖之間的微小的線,但它不是很明顯的我們呃,如果這打擾了你,你可以深入到UISearchbar的視圖層次,並把視圖放在正確的位置。
你解決這個問題我有同樣的問題,開闢了另一個問題 - > http://stackoverflow.com/questions/19467945/ios7-uisearchbar-animation-issue – luca
不,我結束了使用的displaysSearchBarInNavigationBar方法將搜索欄放到導航欄中。這不正是我要去的,但它會做到這一點。如果你找到一個解決方案,你可以把它作爲一個連接器在這裏?謝謝 –