how to use same field to take data into uitextfield and out the result on label
i am writing an application for t开发者_Go百科emperature converter in iphone i want use the same field for data input and output i.e single field which has properties of both uitextfield and uilabel. plz help. thanks
try :
-(IBAction)clculate
{
NSString *input =yourtetfield.text;
Made some caculation
................
................
yourtetfield.text= result;
}
Note result is a string .
Just Try this....write this code on your buttonclick...
-(IBAction)btnGoClicked:(id)sender
{
NSString *strTxtFiled = txtField.text;
int intdata = [strTxtFiled intValue] * 2;
txtField.text = [NSString stringWithFormat:@"%d",intdata];
}
Here txtField is your TextField and I had done some calculation..you can do your calculation as explained here...
well,you can use uitextfield. It has an input (with the text property) and an output (with setText: ) Documentation of uitextfield
'myLabelVariable.text = myUITextfield.Text; is that what your on for?
精彩评论