Ek SAD. Ek SAD. - 1 year ago 95
Objective-C Question

Remove Dynamically added Textfield IOS

I'm having some trouble dynamically removing UITextFields from my scrollview.
I can add 2 UITextFields Dynamically.
To remove UITextFields i am using the bellow given code

[dynamicUITextFields removeFromSuperview];


but only one UITextFields is removed and one Remains as it is .

I want both UITextFields to be removed

thanks in Advance

Answer Source

I totally agree your solution. But it will remove all the UITextField from the current view

Step 1 Add the new added UITextField to Array

Step 2 Loop the array and remove the UITextField from SuperView

    for(UITextField *textField in containerArray){
       [textField removeFromSuperview];
     }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download