Question

I have a view in an application. The view contains a UITableView and a UIToolbar, and within the UIToolbar I have UISegmentedControl that is contained within a UIBarButtonItem object.

I can get the segmented control to link to an IBAction event, and it then acts upon a value change, but I cannot see how to add an IBOutlet to this item.

When I try to add this link, the only object that appears to want to accept the outlet link is the tableview. I would expect this to be wanting to go into an outlet on the File's Owner.

What am I missing here?

Was it helpful?

Solution

Actually, the problem turned out to be that the view was not correctly assigned, and was using an invalid subclass. That was preventing File's Owner from permitting me to see the IBOutlets - which had already been correctly specified in the .h file.

As soon as I corrected the class hierarchy, the problem went away.

Thanks, all y'all, for your assistance.

OTHER TIPS

Your question is unclear.

If your trying to add an outlet to the segmented control i.e. an outlet that runs from the segmented control to another object, then you have to subclass the segmented control with an added outlet property. An outlet is a pointer to an external object so the class has to allocate memory for the pointer and create a symbol for it.

If your trying to link an outlet from the File Owner to the segmented control but are seeing not seeing the File Owner's outlet property as a choice, then you either (1) have defined the outlet incorrectly in the File Owners class or (2) not set the File Owner to the proper class.

For (1), in your File Owner class you should have something that looks like this:

@property (nonatomic, retain) IBOutlet UISegmentedControl *mySegmentedControl; //best

or

@property id mySegmentedControl; //works but is sloppy unless the flexibility is required

For (2) In interface builder, look in the inspector in the identity panel and check that the proper class is assigned to File Owner.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top