UIToolBar selected button state?

I think adding separate Buttons to do that is not a good design and strategy, you should use a UISegmentad control which is a component design for what you want: have one segment selected among X.

I think adding separate Buttons to do that is not a good design and strategy, you should use a UISegmentad control which is a component design for what you want: have one segment selected among X. You can use it like this (to select the first item for example): UISegmentedControl *segment = UISegmentedControl alloc initWithItems:array; segment setSelectedSegmentIndex:0; And to get the selected item: segment. SelectedSegmentIndex.

– Neelesh Mar 18 at 15:21 1 toolBar setItems:NSArray arrayWithObjects:segment, nil; – Ludovic Landry Mar 18 at 15:36 Sorry. I lost you somewhere. Can you please show me how do I create the array.

Is it like NSArray *items=NSArray arrayWithObjects:@"fruits",@"vegetables"; If so how do I set the selector methods? – Neelesh Mar 18 at 15:49 @Narayanan: You can drag and drop UISegmentedControl from the XIB onto the toolbar. – Parth Bhatt Mar 18 at 17:09.

You can use that to access the clicked button, and then set it selected.

The sender argument passed to your fruitClicked handler will be a pointer to the UIBarButtonItem. You can cast it like this: ((UIBarButtonItem*)sender) setEnabled:NO; However, once the button is disable it no longer accepts taps (i.e. You couldn't tap it again to re-enable it).

I would use a customView for the button and implement the enabled/disable appearance yourself.

3 If you really do just want to implement a set of buttons where only one at a time is selected though, you should follow Ludovic's suggestion and use a UISegmentedControl. – Josh Knauer Mar 18 at 15:11 yes..agreed. How do I add the segmented control to the toolbar.? – Neelesh Mar 18 at 15:33.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions