nosuic
nosuic

Reputation: 1360

Facebook-Messages-like Bar Button Items?

I just want to create those buttons at the bottom of the image attached saying "Messages", "Updates", "Sent".

Are these buttons ready-made UIKit buttons? if so what controls are they?

Thank you!

F.

alt text

Upvotes: 0

Views: 307

Answers (3)

nosuic
nosuic

Reputation: 1360

And here's the code for it, as found in the documentation under "Navigation Controllers" in the View Controller Programming Guide for iOS:

Listing 3-3 Configuring a toolbar with a centered segmented control

- (void)configureToolbarItems
{
   UIBarButtonItem *flexibleSpaceButtonItem = [[UIBarButtonItem alloc]
                        initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
                        target:nil action:nil];

   // Create and configure the segmented control
   UISegmentedControl *sortToggle = [[UISegmentedControl alloc]
                        initWithItems:[NSArray arrayWithObjects:@"Ascending",
                                        @"Descending", nil]];
   sortToggle.segmentedControlStyle = UISegmentedControlStyleBar;
   sortToggle.selectedSegmentIndex = 0;
   [sortToggle addTarget:self action:@selector(toggleSorting:)
               forControlEvents:UIControlEventValueChanged];

   // Create the bar button item for the segmented control
   UIBarButtonItem *sortToggleButtonItem = [[UIBarButtonItem alloc]
                                    initWithCustomView:sortToggle];
   [sortToggle release];

   // Set our toolbar items
   self.toolbarItems = [NSArray arrayWithObjects:
                         flexibleSpaceButtonItem,
                         sortToggleButtonItem,
                         flexibleSpaceButtonItem,
                         nil];

   [sortToggleButtonItem release];
   [flexibleSpaceButtonItem release];
}

F.

Upvotes: 0

Suresh Varma
Suresh Varma

Reputation: 9740

That is UISegmentedControl .. check out the link for tutorial...

hAPPY iCODNG...

Upvotes: 1

phi
phi

Reputation: 10733

This is a UISegmentedControl, but I don't think there is support for the badge (the red circle with the number inside). Check this SO question for a similar reply.

You can also have a look to the three20 library, as Facebook is based on that and there might be a class with exactly what you need.

Upvotes: 1

Related Questions