问题
I'm trying to get the contents of an array to display on a uitextfield.
here's my code:
NSArray *arrayConditions = [[NSArray alloc] initWithObjects:[item objectForKey:@"conditions"], nil];
NSString * resultConditions = [arrayConditions description];
// conditionsDeal is the uitextfield self.conditionsDeal.text = resultConditions;
conditions are being pulled from a url like this:
"results": [
{
"conditions": [
"Il coupon è valido per soggiorni fino al...",
"I coupon sono cumulabili, possibilità...",
"Coupon non cumulabile con altre promozioni...",
],
"deadline": "2013-11-27T22:59:59.000Z",
Currently the only thing that displays in my uitextview is:

I need to remove the ( ( ) ) parentheses and format it neatly.
thanks for any help
回答1:
You want to join all the strings in the array like this:
self.conditionsDeal.text = [arrayConditions[@"conditions"] componentsJoinedByString:@"\n"];
回答2:
string = [string stringByReplacingOccurrencesOfString:@"}" withString:@""];
string = [string stringByReplacingOccurrencesOfString:@"{" withString:@""];
string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""];
string = [string stringByReplacingOccurrencesOfString:@" " withString:@" "];
来源:https://stackoverflow.com/questions/14341256/how-to-get-the-contents-of-an-array-to-display-on-a-uitextfield