开发者

iPhone sdk updating text field and label

I have text field and button in one class and label in another class.

I want to update label according to values in text field when bu开发者_Go百科tton is pressed. but label is not updating automatically. i have to restart my application for that.

Any suggestion please?


Use delegate method for this. Send back the NSString value (textfield value) to the first view controller through delegate method when the button is pressed.

In the delegate implementation method, set the value to the UILabel in the main thread, like

[label performSelectorOnMainThread:@selector(setText:) withObject:strValue waitUntilDone:YES];

Also you can refer here.


When the button is pressed, copy the text field to the label.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜