iphone - Add UITextField on UIView programmatically -
how programmatically add uitextfield
on uiview
in iphone programming?
uitextfield* text; uiview* view = [[uiview alloc]init]; [view addsubview:???];
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)
Comments
Post a Comment