2016-06-18 4 views
0

よりも上に移動されて、私はTabBar埋め込まtableViewControllerを持っており、私の携帯に私はtextViewを持っているとtextView's編集は、これがこのやっている方法です開始したときのtableViewを上に移動しようとしています:のtableViewが規定値

func textViewDidBeginEditing(textView: UITextView) { 

if textView == descriptionTextView { 

    let indexPath: NSIndexPath = NSIndexPath(forRow: 4, inSection: 0) 
    self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Middle , animated: true) 

    if textView.textColor == UIColor.lightGrayColor() { 
     textView.text = nil 
     textView.textColor = UIColor.blackColor() 
    } 
    } 
} 

をその細かい作業が、スクロールが十分に滑らかではなく、そのが原因tabBarsのフレーム

の多分これが起こっている下りてくる余分ないくつかのポイントをスクロールし、そのために私はコンテンツのインセットを設定してみました:

tableView.contentInset = (UIEdgeInsets(top: 0, left: 0, bottom: -30, right: 0)) 

まだ編集が開始されたとき

ScrollViewDidScrollからcontentOffSet.yの値を参照して同じ問題を持つ:

tableView is Moving : 236.5 
tableView is Moving : 247.5 
tableView is Moving : 254.0 
tableView is Moving : 255.5 
tableView is Moving : 190.0 
tableView is Moving : 189.5 
tableView is Moving : 189.0 
tableView is Moving : 187.0 
tableView is Moving : 185.0 
tableView is Moving : 182.0 
tableView is Moving : 178.5 
tableView is Moving : 175.0 
tableView is Moving : 171.0 
tableView is Moving : 167.0 
tableView is Moving : 163.0 
tableView is Moving : 159.0 
tableView is Moving : 155.0 
tableView is Moving : 152.0 
tableView is Moving : 149.0 
tableView is Moving : 146.5 
tableView is Moving : 144.5 
tableView is Moving : 143.5 
tableView is Moving : 143.0 

あなたの上には、最初にそのが143.0

まで来て、その後 255.5に行くことがわかります

誰でもこれを修正する方法を知っていますか?

答えて

0
func textViewShouldBeginEditing(textView: UITextView) -> Bool{ 

if textView == descriptionTextView { 

    self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, self.tableView.frame.origin.y, self.tableView.frame.size.width, self.tableView.frame.size.height - 190) 
    let indexPath: NSIndexPath = NSIndexPath(forRow: 4, inSection: 0) 
    UIScrollView .beginAnimations("UP", context: nil) 
      UIScrollView .setAnimationDuration(0.3) 
      scrollView.contentOffset = CGPointMake(0, CGFloat(305 
       + 70 * CGFloat(isiphone6()))) 
      UIScrollView .commitAnimations() 

} 

、 `ここで何をisiphone6`される応答のために、この

+0

ちょっと@KaranJeet感謝をしてみてください? –

+1

あなたの答えを編集してください –

+0

cgfloaft(305 + 70 * cgfloat(Tisiphone 6))を使用しないでください。これらはチェックです。cgpointmake(0,300(上に動く))だけを使用してください。 –

関連する問題