Note that there are some explanatory texts on larger screens.

plurals
  1. POPopulating UITableView with NSArray in iOS 7
    primarykey
    data
    text
    <p>A lot of the methods have deprecated in iOS 7 in order to set font, textLabel, and color for UITableView cells. I'm also just having a difficult time populating the view with these values. Here's a snippet of my code:</p> <pre><code>- (void)fetchedData:(NSData *)responseData { //parse out the json data NSError* error; NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error]; NSArray* jobs = [json objectForKey:@"results"]; for(NSDictionary *jobsInfo in jobs) { JobInfo *jobby = [[JobInfo alloc] init]; jobby.city = jobsInfo[@"city"]; jobby.company = jobsInfo[@"company"]; jobby.url = jobsInfo[@"url"]; jobby.title = jobsInfo[@"jobtitle"]; jobby.snippet = jobsInfo[@"snippet"]; jobby.state = jobsInfo[@"state"]; jobby.time = jobsInfo[@"date"]; jobsArray = [jobsInfo objectForKey:@"results"]; } } </code></pre> <p>I am looping through an array of dictionaries from a GET request and parsed. I am now attempting to fill my UITableView with the following code:</p> <p>-</p> <pre><code> (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [jobsArray count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } NSDictionary *jobsDic = [jobsArray objectAtIndex:indexPath.row]; [cell.textLabel setText:[jobsDic objectForKey:@"jobtitle"]]; return cell; } </code></pre> <p>Also, I have declared this is in my .h file:</p> <pre><code>NSArray *jobsDic; </code></pre> <p>Any ideas on what I'm doing wrong? Is this an iOS 7 problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload