Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

objective C : refresh a view to display updated values

I have a call back function, that on a certain event goes and updates a textField. I use an instance of the viewcontroller class, varViewController to access the textfield from the C code because I can't access the textfield and other members/outlets using self.

Now the problem is, when I update the textfield, it is not instantaneously updated. After I press any other button or do some action on the view, I see the updated value.

void abc(int a, char *b, char *c){

    current = a;

    if (varViewController == NULL)
        NSLog(@"\varViewController is empty");
    else
        NSLog(@"\varViewController");


    varViewController.tempAddress = @"GotSomething";

    [varViewController txtCallId ].text=@"CALLING CALLING";

}  

My questions are :
First : Why is the value not getting updated as it is changed?

Second : How do I make the value appear as soon as it is changed??(value changed in c function).

like image 265
anotherCoder Avatar asked Dec 03 '25 17:12

anotherCoder


1 Answers

In order to force view to re-render try the following

[varViewController.view setNeedsDisplay];
like image 102
Misha Avatar answered Dec 06 '25 07:12

Misha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!