Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. NSString *plistCatPath = [[NSBundle mainBundle] pathForResource:@"candidateList" ofType:@"plist"];
  2. NSArray *candidateArray = [[NSArray alloc] initWithContentsOfFile:plistCatPath];
  3.  
  4. NSMutableArray *candidates = [NSMutableArray new]; //should keep a reference in the header or wherever you keep your variables
  5.  
  6. for (NSDictionary *candidateDictionary in candidateArray)
  7. {
  8. Candidate *candidate = [Candidate new];
  9. candidate.name = candidateDictionary[@"name"];
  10. candidate.politicalView = candidateDictionary[@"politicalView"];
  11. candidate.age = candidateDictionary[@"age"];
  12. candidate.region = candidateDictionary[@"region"];
  13.  
  14.  
  15. [candidates addObject:candidate];
  16. }
  17.  
  18. for (Candidate *candidate in candidates)
  19. {
  20. //here is where you would build your pages/scrollview/whatever unless you are using a tableview (cellForRowAtIndexPath)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement