4

UIRefreshControlsearchController API와 함께 테이블보기에서 navigationItem에 사용하려고합니다.
hidesSearchBarWhenScrolling을 설정하면 "새로 고침 풀다운"애니메이션이 더 이상 표시되지 않고 새로 고침 컨트롤이 특정 시점에 팝업됩니다.UIRefreshControl이있는 탐색 모음의 UISearchController가 레이아웃 결함을 야기 함

enter image description here

(매년 같은 ... 동일한 절차) UIKit의 버그를 것으로 보인다. 누구나 해결책을 찾았습니까?

는 문제가 새로운 아이폰 OS 11 "마스터/세부"샘플 프로젝트에 이것을 추가 재현하려면

- (void)viewDidLoad { 
    // [setup code here] 

    self.refreshControl = [UIRefreshControl new]; 
    self.navigationItem.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; 
    self.navigationItem.hidesSearchBarWhenScrolling = NO; // <-- setting this causes jumpy UI 
} 

답변

0

난 그냥 같은 문제가 발생했습니다. 그것은 확실히 UIKit의 버그처럼 보입니다. 확실히 뭔가 filing a radar이 될 것입니다.

는 그래도 난을 완화하기 위해 매우 해키 방법을 발견

- (void)scrollViewDidScroll:(UIScrollView *)scrollView 
{ 
    //Fixes a bug in UIKit where the refresh control is broken when `hidesSearchBarWhenScrolling` is NO. 
    if (@available(iOS 11.0, *)) { 
     self.navigationItem.hidesSearchBarWhenScrolling = scrollView.contentOffset.y < -scrollView.adjustedContentInset.top; 
    } 
} 

기본적으로 여기에서 일어나고있는 것은을 그 코드의 때마다 상단 과거 스크롤 뷰 스크롤 (새로 고침 컨트롤이 표시 될 것입니다 경우),이 비트 hidesSearchBarWhenScrollingYES으로 되돌아갑니다. 사용자가 다시 아래로 스크롤하면 NO으로 다시 설정되며 검색 창은 계속 표시됩니다.

잘하면 Apple은 향후 iOS 버전에서이 문제를 해결할 예정이지만 현재 배송 버전의 경우이를 수행해야 할 것입니다.