-1

I have a counter in controller A that ask for the number of tickets, and a second controller with that amount of text fields asking for user to input the ticket numbers

Example, if user inputs 5 in controller A, I have to create 5 text fields in controller B, and a label at the top of Controller B "What are the ticket numbers".

How can this be done?

P/S: There is no max limit for the number of tickets.

Happiehappie
  • 1,084
  • 2
  • 13
  • 26

1 Answers1

-1

You Need to take a one UIScrollView and create you textField dynamically via below code consider your y position for first textField is 10.

    int y = 10;
    for( int i = 0; i < 5; i++ ) {
        UITextField *objTextFiled = [[UITextField alloc]  initWithFrame:CGRectMake(10, y, 200, 40)];
        objTextFiled.delegate = self;
        y = objTextFiled.frame.size.height + 10;
        [self.scrollView addSubView:objTextFiled];
    }

after that you need to set content off set for your scrollView

Bhupesh
  • 2,310
  • 13
  • 33
  • How do I define my content size for the height, let's say there is 10 text fields? – Happiehappie Oct 07 '15 at 10:28
  • @Happiehappie see my ans here in this link http://stackoverflow.com/questions/17042004/uiscrollview-subviews-contents-size-issue/17042152#17042152 – Bhupesh Oct 07 '15 at 10:32
  • Then must I create my scroll view programatically or with storyboard? Or it doesn't matter? If I'm going to create it programatically, when do I self.view.addSubview(self.scrollView) – Happiehappie Oct 08 '15 at 07:34
  • no it doesn't matter. you took scroll view with story board – Bhupesh Oct 08 '15 at 08:34