Adding UITextField on UIView Programmatically Swift

前端 未结 9 1273
不知归路
不知归路 2021-01-30 06:42

I\'m new to Swift and iOS programming. I was trying to create a UITextField programmatically using Swift but couldn\'t get it quite right. Also how do you change it

9条回答
  •  别那么骄傲
    2021-01-30 07:41

    You need to add text field to self.view instead of self.

    var myField: UITextField = UITextField (frame:CGRectMake(10, 10, 30, 10));
    self.view.addSubview(myField) 
    

    For add translucent blur effect there are already a couple of suggestions available, you can go through -

    UIView border with fade or blur effect

提交回复
热议问题