Revision: 27763
Updated Code
at June 22, 2010 19:14 by devb0yax
Updated Code
.h file: @interface ResultsViewController : UITableViewController { NSMutableArray *m_list; NSDictionary *localDict; } @property(nonatomic,retain) NSMutableArray *m_list; @end ======================== .m file: - (void)viewDidLoad { [super viewDidLoad]; NSDictionary *tempDict; AdInfo *shAdInfo = [AdInfo sharedAdInfo]; tempDict = shAdInfo.adInfoDict; int nCountDict = [tempDict count]; NSLog(@"nCountDict: %d", nCountDict); //////////////////////// NSMutableArray *myMutableArr = [[NSMutableArray alloc] init]; int ctr; for(ctr = 1; ctr <= nCountDict; ctr++) { localDict = [tempDict objectForKey:[NSString stringWithFormat:@"%d", ctr]]; [myMutableArr addObject:localDict]; } self.m_list = myMutableArr; [myMutableArr release]; NSLog(@"m_list count: %d", [m_list 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] autorelease]; } // Configure the cell... NSUInteger row = [indexPath row]; NSDictionary *newDict = [NSDictionary dictionaryWithDictionary:[m_list objectAtIndex:row]]; //NSLog(@"newDict desc: %@", [newDict description]); NSString *rowString = [newDict objectForKey:@"text"]; cell.textLabel.text = rowString; [rowString release]; return cell; }
Revision: 27762
Updated Code
at June 22, 2010 19:11 by devb0yax
Updated Code
.h file: @interface ResultsViewController : UITableViewController { NSMutableArray *m_list; NSDictionary *localDict; } @property(nonatomic,retain) NSMutableArray *m_list; @end ======================== .m file: - (void)viewDidLoad { [super viewDidLoad]; NSDictionary *tempDict; AdInfo *shAdInfo = [AdInfo sharedAdInfo]; tempDict = shAdInfo.adInfoDict; int nCountDict = [tempDict count]; NSLog(@"nCountDict: %d", nCountDict); //////////////////////// NSMutableArray *myMutableArr = [[NSMutableArray alloc] init]; int ctr; for(ctr = 1; ctr <= nCountDict; ctr++) { localDict = [tempDict objectForKey:[NSString stringWithFormat:@"%d", ctr]]; [myMutableArr addObject:localDict]; } self.m_list = myMutableArr; [myMutableArr release]; NSLog(@"m_list count: %d", [m_list 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] autorelease]; } // Configure the cell... NSUInteger row = [indexPath row]; NSDictionary *newDict = [NSDictionary dictionaryWithDictionary:[m_list objectAtIndex:row]]; //NSLog(@"newDict desc: %@", [newDict description]); NSString *rowString = [newDict objectForKey:@"ads_text"]; cell.textLabel.text = rowString; [rowString release]; return cell; }
Revision: 27761
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 22, 2010 18:39 by devb0yax
Initial Code
.h file: @interface ResultsViewController : UITableViewController { NSMutableArray *m_list; NSDictionary *localDict; } @property(nonatomic,retain) NSArray *m_list; @end ======================== .m file: - (void)viewDidLoad { [super viewDidLoad]; NSDictionary *tempDict; AdInfo *shAdInfo = [AdInfo sharedAdInfo]; tempDict = shAdInfo.adInfoDict; int nCountDict = [tempDict count]; NSLog(@"nCountDict: %d", nCountDict); //////////////////////// NSMutableArray *myMutableArr = [[NSMutableArray alloc] init]; int ctr; //NSDictionary *localDict; for(ctr = 1; ctr <= nCountDict; ctr++) { localDict = [tempDict objectForKey:[NSString stringWithFormat:@"%d", ctr]]; [myMutableArr addObject:localDict]; } self.m_list = myMutableArr; [myMutableArr release]; NSLog(@"m_list count: %d", [m_list 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] autorelease]; } // Configure the cell... NSUInteger row = [indexPath row]; NSDictionary *newDict = [NSDictionary dictionaryWithDictionary:localDict]; NSDictionary *tempDict = [newDict objectForKey:[NSString stringWithFormat:@"%d", row]]; NSString *rowString = [tempDict objectForKey:@"ads_text"]; cell.textLabel.text = rowString; return cell; }
Initial URL
Initial Description
Initial Title
NSDictionary populating to table view
Initial Tags
Initial Language
iPhone