In my application, im showing a list of objects on a UIListView. (MasterViewController.m)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
ObrasData *obra = [self.arrObras objectAtIndex:indexPath.row];
cell.textLabel.text = obra.descripcion;
return cell;
}
Im trying to show all the data from the object, in this case, im only loading one field to test the app. (DetailViewController.m)
- (void)configureView
{
// Update the user interface for the detail item.
if (self.detailItem) {
self.NombreObra.text = [self.detailItem description];
}
}
When im going to the the DetailView, i got the following text in the label ->
<ObrasData: 0x892b4b0>
So, what is the best way to load all the data from the object? Here is where i load the array:
ObrasData *obra1 = [[ObrasData alloc] initWithID:[NSNumber numberWithInt:1] presupuesto:@"100" description:@"obra de prueba" aasm_state:@"En proceso" clienteID:@"dm2"];
NSMutableArray *arrObras = [NSMutableArray arrayWithObjects:obra1, nil];
UINavigationController *navController = (UINavigationController *) self.window.rootViewController;
MasterViewController *masterController = [navController.viewControllers objectAtIndex:0];
masterController.arrObras = arrObras;
Thanks for your help.
"description" is a method on NSObject that returns a textual description of an object, and what you're seeing is the default implementation (which just prints the address).
That implies that you don't have a method implemented that overrrides "description" to returns something else.
Without seeing what ObrasData's implementation looks like, it's hard to guide you more.
Edit, having seen the implementation I see that you have a property called "descripcion" (in Spanish) that you initialise in the init method. I assume then that you actually want to do this:
[self.detailItem descripcion]
If, on the other hand you really do want to describe the whole object then you need to override the description method e.g.
- (NSString *)description
{
return [NSString <create your description yourself here>];
}