TenD
TenD

Reputation: 43

Buttons simulating tabs' looks (somewhat)

What is the best way in iOS to get the following:

screenshot

3 buttons(?) that will change info displayed after tap. I have something in mind but i would like to hear from someone with experience. I am asking about how to get the looks of that, will it be best to use buttons one next to another, if so how to change border from one side only? If not what do? Also if its a repost of some sort i apologize, couldnt find anything via search.

Upvotes: 0

Views: 59

Answers (2)

hishamaus
hishamaus

Reputation: 183

The best way is to use UISegmentedControl

This is a standard way of creating the switcher:

UISegmentedControl *switcher = [[UISegmentedControl alloc] initWithItems: items];
                switcher.segmentedControlStyle = UISegmentedControlStyleBar;
                switcher.tintColor = self.navigationController.navigationBar.tintColor;
                [switcher addTarget:self action: @selector(switcherTapped:)
                         forControlEvents: UIControlEventValueChanged];

"items" is an array of the 3 items you want to switch between.

Upvotes: 1

Sean
Sean

Reputation: 1045

This seems to be a pretty standard Segmented Control object with a custom gradient or image for each button.

Upvotes: 1

Related Questions