1

I have my own subclass of UITabBarController. I am trying now to add a simple button (UITabBarItem) in the storyboard. The thing is that I don't want to associate a controller with it. An action on that item will simply fire a prompting alert to confirm switching between two modes.

So, what is the clean way to add an element in tab bar from StoryBoard without linking to anything (and doing stuff programatically) ?

ffarquet
  • 1,263
  • 12
  • 27
  • without telling us what you tried and posting problems you are less likely to get the answer you want. – madmik3 Jul 21 '14 at 13:03
  • I only know how to add tab bar items in StoryBoard using a new controller. I am just trying to find another way... – ffarquet Jul 21 '14 at 13:10

1 Answers1

1

is this what you're looking for? Via delegation you can define the items' behaviour set up an action with a tab bar item - iphone

edit: i don't know about storyboard only. but doing it that way wouldn't really be hard. Define your custom TabBarController, use the delegate method and implement your logic.

Community
  • 1
  • 1
Ju7
  • 26
  • 4
  • This is already what I want to use to fire my prompting alert. But how do I add the UITabBarItem to the StoryBoard without linking it to a controller? – ffarquet Jul 21 '14 at 13:13
  • have you tried specifying an identifier for the button and then to identify the idem in the delegate method? Either way, i think it's probably best to simply create a subclass of the viewcontroller... – Ju7 Jul 21 '14 at 13:16
  • You mean subclassing the UITabBarController and adding items programatically ? There is no way to add graphically the button in StoryBoard? – ffarquet Jul 21 '14 at 13:19
  • 1
    no, my guess was that you could use storyboard for adding all the items you want to have. and then you specify a custom view controller which you pass in storyboard. Your derived View Controller can then use the delegate method and identify the tabbaritem available as parameter – Ju7 Jul 21 '14 at 13:24
  • 1
    I've just tried it out and it works. Simply define your custom TabBarController, use the delegate method and implement your logic – Ju7 Jul 21 '14 at 13:46