I tried to do a bottom up UIPickerView component, first i created a container view, other than my actual view, then i added a picker view to container view. I set this view's y position to 1690. If button pressed it'll move up with animation like that.
func createPicker(sender: UIButton)
{
if(isPickerViewOpened == false){
pickerView.reloadAllComponents()
shadowImageView.alpha = 0.6
UIView.animateWithDuration(0.5, animations: { () -> Void in
self.pickerContainer.center = CGPointMake(self.pickerContainer.center.x, self.pickerContainer.center.y - 1000)
})
isPickerViewOpened = true
}
}
But when the DidSelectRow function worked, that view goes back to its original position.
My DidSelectRow function:
func pickerView(pickerView: UIPickerView!, didSelectRow row: Int, inComponent component: Int)
{
urunCesitButton.setTitle("\(urunCesitAd[row])", forState: .Normal)
urunKodu = urunCesitKod[row]
urunAd = urunCesitAd[row]
urunFiyat = urunCesitFiyat[row]
urunAdLabel.text = urunAd
urunFiyatLabel.text = "\(urunFiyat) TL"
shadowImageView.alpha = 0
scrollerView.userInteractionEnabled = true
decreaseButtonOutlet.userInteractionEnabled = true
urunAdet.userInteractionEnabled = true
increaseButtonOutlet.userInteractionEnabled = true
}
I tried endEditing or resignFirstResponder() to solved that but it doesn't work. Someone else also asked this question but he didn't get an answer.