开发者

how to assign an integer array to the UITextfield [duplicate]

This question already has answers here: 开发者_Go百科 Closed 11 years ago.

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];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜