I am trying to add a UITextField to a view controller in my app using the following code :
passTextField = [[UITextField alloc] initWithFrame:CGRectMake(30, CGRectGetMaxY(userTextField.frame)+20, self.view.frame.size.width-60, 30)];
passTextField.placeholder = @"Password";
passTextField.textColor = [UIColor darkGrayColor];
passTextField.backgroundColor = [UIColor whiteColor];
passTextField.layer.borderWidth = 1.0f;
passTextField.layer.borderColor = [[UIColor lightGrayColor] CGColor];
passTextField.leftView = paddingView;
passTextField.leftViewMode = UITextFieldViewModeAlways;
passTextField.layer.cornerRadius = 4.0f;
passTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
passTextField.secureTextEntry = YES;
passTextField.delegate = self;
The whole app works fine but as soon as it tries to load the view that contains the 'passTextField' mentioned above, the whole app freezes forcing me but to kill it.
What am I doing wrong? I know it's something silly.
Apparently, I was using the paddingView I had defined for another UITextField in this same view which was causing it to go into an infinite loop. Declaring a seperate paddingView solved my problem.