Iqbal Khan
Iqbal Khan

Reputation: 4617

Retrieve UISegmentedControl object out of UIBarButtonItem

I need to get the UISegmentedControl object that i previously added in the UIBarButtonItem like this

UIBarButtonItem *segmentBarButton=[[UIBarButtonItem alloc] initWithCustomView:segmaentControl];

now i want to get the UISegmentedControl object out of it, how can i do this?

Upvotes: 0

Views: 526

Answers (1)

Jacob Relkin
Jacob Relkin

Reputation: 163318

UIBarButtonItem has a property called customView, which is what you're looking for:

UISegmentedControl *control = (UISegmentedControl *) [segmentBarButton customView];

Upvotes: 5

Related Questions