Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift uipickerview

class VC: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
  var picker: UIPickerView!

    let pickerValues = ["One", "Two", "Three"]

    func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int{
        return pickerValues.count
    }

    func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int{
        return 1
    }

    func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
        return pickerValues[row]
    }

    func pickerView(pickerView: UIPickerView!, didSelectRow row: Int, inComponent component: Int){
        textField.text = pickerValues[row]
    }

    func setUp() {

        picker = UIPickerView()

        picker.dataSource = self
        picker.delegate = self

        textField.inputView = picker 
    }
  
}
Comment

PREVIOUS NEXT
Code Example
Swift :: check when webview finish loading swift 
Swift :: Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral 
Swift :: swift check dictionary has key 
Swift :: swift get top constraint 
Swift :: ionic Library not found for -lGoogleToolboxForMac 
Swift :: round down swift 
Swift :: swift convert data to dictionary 
Swift :: Save class in userdefaults ios swift 
Swift :: swipe to delete xcode 
Swift :: add corner radius to uiview swift 
Swift :: get class name swift 
Swift :: post request in swift 
Swift :: unit testing swift 
Swift :: clone repo using jenkins pipeline 
Swift :: how do i have countdown timer in swift stackoverflow 
Swift :: go to view controller programmatically swift 
Swift :: swift contains 
Swift :: swift edit constraint programmatically 
Swift :: add shadow to specific corner of UIView with shadow swift 6 site:stackoverflow.com 
Swift :: symfony swiftmailer 
Swift :: swift sort list true before false 
Swift :: setting a local notification at specific time every day swift 
Swift :: swift 5 change message color of alert 
Swift :: swift create lazy property 
Swift :: SwiftCSV and RealmSwift library 
Swift :: Swift Overloading with Different Parameter Types 
Swift :: table flutter stackoverflow 
Swift :: Swift Equatable Protocol 
Swift :: how to print body moya swift 
Swift :: swiftui slide menu 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =