Hi All,
I am pretty new to Iphone development . so please bear me if I ask some very simple questions.
In my application I have multiple views(i.e. .xib files). On clicking the button on the main view(CouponWebsiteViewController.Xib) the application should load the second view(BrowseList.Xib) which contains a UITable and I have to populate that UITable with some data. I have written following code to populate the data on BrowseList.m file:
(void) viewDidLoad{ arrayData = [[NSArray alloc] init]; arrayData = [arrayData arrayByAddingObject:@"dfsgdf"]; arrayData = [arrayData arrayByAddingObject:@"aaaaaa"]; self.lblNewScreen.text = [arrayData objectAtIndex:0]; [super viewDidLoad]; }
(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; }
// Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [arrayData count]; }
// Customize the appearance of table view cells. - (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]; }
NSString *cellValue = [arrayData objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
[tableView setEditing:YES animated:YES];
return cell;
}
But It is not populating the data in table , when I debug this code I found that it is not executing cellForRowAtIndexPath method but it is debugging numberOfRowsInSection and numberOfSectionsInTableView methods.
But the interesting thing is when I write the same code on the CouponWebsiteViewController.m (i.e. on main view) then it is populating the data in table.
The point is this code is working fine on the main view but it does not work for the other views.
Can any one tell me what am I missing or any other way to populate the UITable on views other than the main view.
Thanks in Advance. Gaurav