Facebook-Messages-like Bar Button Items?
I just want to create those buttons at the bottom of the imag开发者_运维百科e attached saying "Messages", "Updates", "Sent".
Are these buttons ready-made UIKit buttons? if so what controls are they?
Thank you!
F.
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.
That is UISegmentedControl .. check out the link for tutorial...
hAPPY iCODNG...
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.
精彩评论