I’ve got this mock up:

As you can see, it’s a sort of navigation-menu. It’s functionality should be the same as a segmented control, and i am going to change the tableView based on the item active.
What would be the easiest way to implement this?
I have started makin my UIView-subclass, but found out that i had to then make a delegate, watch for tap-events and stuff.
Is this the best way to do it? Should i subclass UISegmentedControl?
Any other advice?
Please, point me in the right direction. I feel confident in Obj-c, but making these kinds of stuff makes my mind goes crazy.
Conceptually,
UISegmentedControlseems like a good choice for this, but I don’t think it’s quite flexible enough to create the effect you’re going for here.Have you considered putting three
UIButtoncontrols inside a custom view? You can customize the images for each button usingsetBackgroundImage:forState:to get the border style in your mockup. Set theselectedproperty of the pressed button toYES, andUIButtonwill handle the drawing for you.You can set up an action method to detect which button was pressed by calling
A delegate is just any class that conforms to a protocol you create. So you would create a delegate protocol in your header like this:
And the delegate is just a property in your
MyControlclass:And in your button press handlers, for example:
Now, you just have to have the view controller that contains your control adopt the protocol:
And implement the method: