3 Component Dynamic Multi UIPickerView Swift

后端 未结 1 1760
迷失自我
迷失自我 2021-01-21 09:34

I\'m new to Swift programming (doing it for fun :)) and am stuck with trying to create a 3 component UIpickerview where each component changes its value based on the previous co

1条回答
  •  佛祖请我去吃肉
    2021-01-21 09:52

    Create Country & City objects like below. Assign array of City to cities.

    class Country {
    
        var name: String
        var cities: [City]
    
        init(name:String, cities:[City]) {
            self.name = name
            self.cities = cities
        }
    }
    
    class City {
    
        var name: String
        var posts: [String]
    
        init(name:String, posts:[String]) {
            self.name = name
            self.posts = posts
        }
    }
    

    0 讨论(0)
提交回复
热议问题