Search code examples
iosobjective-cuitextfieldviewdidload

TextField.text is not working after ViewDidLoad


I want to fill the UITextField after viewDidLoad, but after viewDidLoad I assign the UITextField does not appear in any appreciable way. I do this in viewDidLoad UITextField process;

_TextField.delegate = self;

Idle (after viewDidLoad)

_TextField.text = [listArray objectAtIndex:0]; // listarray is full
[_TextField setText:@"aaa"]; // The second way : not working

Need some guidance on what could be going wrong here.

Thanks.


Solution

    1. Check whether the textfield text colour is not the same as its background.
    2. Remove : _TextField.delegate = self;.
    3. Check the storyboard textfield is connected properly where you defined @property(strong, nonatomic) IBOutlet UITextField * TextField;