Have an NSSegmentedControl and I am trying to attach different representedObject's to each NSSegmentedCell. I think I may be doing something incorrectly because it does not appear to be working.
[mySegmentedControl setSelectedSegmented:0];
[mySegmentedControl selectedCell] setRepresentedObject:myObject0];
[mySegmentedControl setSelectedSegmented:1];
[mySegmentedControl selectedCell] setRepresentedObject:myObject1];
?
Then I thought it would be as simple as:
[mySegmentedControl setSelectedSegment:0];
myObjectType *type = (myObjectType *)[[mySegmentedControl selectedCell] representedObject];
Does not appear to be working though? Am I doing something incorrectly? My issue appears to be that:
[[mySegmentedControl selectedCell] representedObject]
always seems to the latest object that I attached. So if I select Segment 0 and it will return the representedObject that I attached for segment 1. Any ideas why?