views:

42

answers:

2
//Initialize the detail view controller and display it.
OrderDetailsView *dvController = [[OrderDetailsView alloc] initWithNibName:@"OrderDetailsView" bundle:[NSBundle mainBundle]];
dvController.selectedOrder = (@"%@",selectedOrder);
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;

What seems to be the problem ?

i am getting the error: object cannot be set - either readonly property or no setter found

A: 

In the OrderDetailsView.h add the following :

@property (nonatomic, retain) [TYPEOFSELECTEDORDER]* selectedOrder;

And in the OrderDetailsView.m :

@synthesize selectedOrder;
MathieuF
A: 

To help you, we would need the OrderDetailsView header content (especially the part where selectedOrder appears).

Given the error, i would say that you did not declare the property in the header like this :

@property(retain) NSString *selectedOrder;

Then you can either define the setter and getter for this property yourself in the implementation file (OrderDetailsView.m) like this :

- (NSString *) selectedOrder {
  // your getter implementation here
}
- (void) setSelectedOrder:(NSString *) value {
  // your setter implementation here
}

Or you can use @synthesize selectedOrder; at the top of your class implementation. @synthesize will handle all the memory stuff for you, given the information you provide in the @property

David