Keshab
Keshab

Reputation: 142

how can i add dynamic labels and text input field in xcode

I'm trying to ask user how many variables he like to enter then my program should create label for each variable and input field for each variable. I need help to figure out how can I generate running time label fields and input fields in Xcode. I have a solution which asks values for each variable. But I badly need to use dynamic label fields and input fields.

Upvotes: 1

Views: 1352

Answers (1)

Martin O'Shea
Martin O'Shea

Reputation: 432

Have you tried doing this in code, it is quite straight forward.

UILabel *dynamicLabel = [UILabel alloc] initWithFramee:CGRectMake(0,0,50,30)];
[self.view addSubview:dynamicLabel];

UITextField *dynamicTextFeild = [[UITextField alloc] initWithFrame:CGRectMake(50, 0, 50, 30)];
[self.view addSubview:dynamicTextFeild];

Edit for desired layout.

Hope this helps.

Upvotes: 1

Related Questions