× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Creating a NSString from a parse class property that is a array of PFObjects

Camilo Aguilar
Feb 08, 2015
<p>Let's think that we va a class named Product and another class name Categories. Products has a column that is of type Array where you are storing the categories for that product. </p> <p>So, what we would like to do is to present the list of categories in your viewController in a UILabel in this format: </p> <p>"CategoryTitle1, CategoryTitle2, CategoryTitle3"</p> <p>So in order to get the title from the Category array we can do something like this:</p> <pre><code class="language-objectivec">NSArray *arrayOfCategories = parseObject[@"categories"]; NSString *result = [[arrayOfCategories valueForKey:@"title"] componentsJoinedByString:@","]; self.lblCategories.text = result;</code></pre> <p> </p>
comments powered by Disqus