开发者

Facebook-Messages-like Bar Button Items?

开发者 https://www.devze.com 2023-02-02 02:58 出处:网络
I just want to create those buttons at the bottom of the imag开发者_运维百科e attached saying \"Messages\", \"Updates\", \"Sent\".

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.

Facebook-Messages-like Bar Button Items?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消