how to assign an integer array to the UITextfield [duplicate]
Possible Duplicate:
how to assign an integer data type array values to a UITextField in iphone
how to assign an integer data type array values to a UITextField in iphone here is the code:
for(i=j;j>=0;j--)
{
printf("%d",b[j]);
}
NSString *string =[NSString stringWithFormat:@"%d", b];
outputTextField.text = string;
but it does not works.
I don't know what are you trying to achieve, do you want whole array to be assigned to textfield or simply on element?
for a single element use
NSString *string =[NSString stringWithFormat:@"%d", b[elementNumber]];
outputTextField.text = string;
if you are trying to assign whole array then use
NSMutableString *str = [[NSMutableString alloc] init];
for(i=j;j>=0;j--)
{
printf("%d",b[j]);
[str appendFormat:@"%d",b[j]];
}
outputTextField.text = str;
[str release];
Try like this
NSMutablearray *array1;
textfield.text=[array1 objectAtIndex:1];
精彩评论