Add UITextField on UIView programmatically
iphone, uitextfield, uiview
Solution
Objective-C:
CGRect someRect = CGRectMake(0.0, 0.0, 100.0, 30.0);
UITextField* text = [[UITextField alloc] initWithFrame:someRect];
UIView* view = [[UIView alloc] initWithFrame:someRect];
[view addSubview:text];
Swift:
let someFrame = CGRect(x: 0.0, y: 0.0, width: 100.0, height: 30.0)
let text = UITextField(frame: someFrame)
let view = UIView(frame: someFrame)
view.addSubview(text)
Problem
How to programmatically add `UITextField` on `UIView` in iPhone programming? ``` UITextField* text; UIView* view = [[UIView alloc]init]; [view addSubview:???]; ```