2017-12-14 3 views
0

난 그냥 보여 테이블 뷰 이미지를 스크롤 그러나 여기에서 나는 테이블 검색 창은 또한 내가 아래로 스크롤 이제까지 검색 창 올 필요가있을 때 위로하고 숨기고로 이동해야 볼 스크롤 시작할 때처럼 필요 동안 숨기기 위해 노력했다 아래 테이블보기 스크롤 및 동일한 위치에 수정 누구든지이 구현하는 방법을 도울 수 있습니까? 테이블보기에서 스크롤하는 동안 위로 이동하고 숨길 검색 막대를 만드는 방법은 무엇입니까?

다음은 이미 스크롤을 검출 시도 내 코드 때있는 tableview에 테이블 뷰 스크롤

func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { 

     if(velocity.y>0) { 
      //Code will work without the animation block.I am using animation block incase if you want to set any delay to it. 
      UIView.animate(withDuration: 1.5, delay: 0, options: UIViewAnimationOptions(), animations: { 
       self.searchBar.isHidden = true 
       print("Hide") 
      }, completion: nil) 

     } else { 
      UIView.animate(withDuration: 1.5, delay: 0, options: UIViewAnimationOptions(), animations: { 
       self.searchBar.isHidden = false 
       print("Unhide") 
      }, completion: nil)  
     } 
    } 

답변

0

간단한 드래그 검색 창.

+0

아니요 여기에 표시된 것과 같은 표보기 이미지 위에 검색 막대가 있어야합니다. –

+0

https://i.stack.imgur.com/sfnq4.png –

+0

검색 막대를 tablview 셀로 드래그하십시오. 그것은 tablview 셀의 상단에 합류합니다. –

관련 문제