2017-12-08 7 views
0

私は静的なセルを持つUITableViewを持っています。同じContent Viewの高さ制約をUIPickerビューの高さに設定しました。私はまた、UITableViewCellのコンテンツビューを変更してdidSelectRowAtメソッドを実装しました。 enter image description here https://youtu.be/lJuTLQ1oTaEiOSアニメーションUIPickerの高さの変更

魔法が起こると、TableViewCellの高さの変化がアニメーション化されます。しかし、UIPickerViewの高さの次の変更はアニメーションなしで同時に起こります。私はlayoutIfNeeded()でUIView.animateを配置しようとしましたが、それは役に立ちませんでした。

UIPickerViewの高さの自動変更をアニメーション化する方法はありますか?

// TableView functions 
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 
    if let cell = tableView.cellForRow(at: indexPath) { 
     let reuseIdentifier = cell.reuseIdentifier 
     guard reuseIdentifier != nil else {return} 

    if reuseIdentifier == "currencyPickerTableViewCell" && self.selectedCellIndexPath == nil { 
     self.skipCellsFromGestureRecognition.append(indexPath) 
     self.selectedCellIndexPath = indexPath 
     print(currencyPicker.constraints) 
     tableView.beginUpdates() 
     tableView.endUpdates() 
    } else if reuseIdentifier == "currencyPickerTableViewCell" && self.selectedCellIndexPath != nil { 
     self.selectedCellIndexPath = nil 
     self.tableView.beginUpdates() 
     self.tableView.endUpdates() 
    } 
} 
} 

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 
    if self.selectedCellIndexPath == indexPath { 
     return self.selectedCellHeight 
    } else { 
     return self.unselectedCellHeight 
    } 
} 

答えて

0

もピッカーのあなたの幅があることに注意してUIPickerのフォントは、あなたがそれを参照してください、そうUIView.animate内のフォントを変更することはできません同じままとアニメーションが実際に発生したが、静的なので、フォントが大きくなるとトリムされる文字の数が増えます。 。 。

+0

あなたはおそらく私の質問に誤解しました。私はフォントとそれのサイズを変更しません。私は行でUIPickerViewを拡張しようとしています。 –

関連する問題