I was just playing around with IOS and I hit a problem and it seems so simple that I can’t believe it’s not working
I have a table list
I have set up all the delegate so that it displays information from a plist
that works
however when I switched to my custom view for the internal layout, I get the default text of the view but not the text form the plist
Here is some code of the table view controller:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DefaultCell"];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DefaultCell"];
}
EmergencyContactItemConrtroller *genericViewController = [[EmergencyContactItemConrtroller alloc] initWithNibName:@"EmergencyContactItemConrtroller" bundle:nil];
[genericViewController setInitialParametersWithTitle:[[emergencyArray objectAtIndex:indexPath.row]objectForKey:@"Title"]
withCatption:[[emergencyArray objectAtIndex:indexPath.row]objectForKey:@"Caption"]
withNumber:[[emergencyArray objectAtIndex:indexPath.row]objectForKey:@"Number"]
withOtherInfo:nil];
[cell.contentView addSubview:genericViewController.view];
return cell;
}
and here is the code of setInitialParametersWithTitle in the cell view controller.
-(void) setInitialParametersWithTitle:(NSString *)title
withCatption:(NSString *)caption
withNumber:(NSString *)number
withOtherInfo:(NSDictionary *)otherInfo{
self.titleLable.text = title;
self.captionLable.text = caption;
[self.numberButton setTitle:number forState:UIControlStateNormal];
}
I checked that the xib IBOutlet are linked correctly.
when I try to debug I get he right values send to the function, how ever when I printout self.titleLable.text before assigning a value to it, there is no value in it.
Any Ideas ?
Jason
EmergencyContactItemConrtroller is UIViewController class?
All IBOutlets will initialized after
is done; Then you should change them