-2

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.

Dhrumil
  • 3,221
  • 6
  • 21
  • 34
Burak Benli
  • 39
  • 2
  • 8
  • is your textfield visible in view? – Rajesh Aug 04 '14 at 07:12
  • Can you check `NSLog(@"TextField : %@", _TextField);` and see whether or not _TextField is `nil`. – Krishnabhadra Aug 04 '14 at 07:13
  • Yes, of course it looks(page first loads just do not assign a value to TextField) – Burak Benli Aug 04 '14 at 07:13
  • @Krishnabhadra After you assign a value, `textField: (null)` returns. So, do not be disposed of in any way that value into the TextField. – Burak Benli Aug 04 '14 at 07:17
  • In which method are you assigning value to the textfield? can you show more code? Are you using the XIB approach or the code approach to show the textfield if its code then did you do [self.view addSubview:yourtextfield];. Also don't forget to set the frames and border of textfield if the textfield is added programmatically – user2538944 Aug 04 '14 at 07:18
  • if you do this in viewDidLoad, you just do it in viewDidLoad, not after viewDidLoad. If you want to do it after viewDidLoad do it in viewDidAppear or viewWillAppear – Bogdan Somlea Aug 04 '14 at 07:20
  • check your textfield textColor... – IKKA Aug 04 '14 at 07:25
  • Its a week refrence as you have used it by the `_textfield.` make it synthesise and then use the it as `textfield` . It will work – Esha Aug 04 '14 at 07:27

1 Answers1

0
  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;
Janani M
  • 423
  • 3
  • 13