How do they imprement this kind of button in attached picture of iPhone app?
Hello everyone,
I need help on creating a button like in the above picture. They are multiple buttons that are used to switch to another view and the next button to show a hidden button.I 'd like to know which UI Control to use.
Whichever free ready-to-use control or code example is preferred.Thank you very much.
I did what Mayur Joshi's suggestion but don't understand why I can't scroll buttons in scrollview and there's no text on buttons.
开发者_JAVA百科This is my code
- (void)viewDidLoad
{
[super viewDidLoad];
[scrollView setContentSize:CGSizeMake(500.0f, 50.0f)];
[self.view addSubview: scrollView];
UIButton *button1 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
[button1 setTitle:@"Button1" forState:UIControlStateNormal];
[button1 setFrame:CGRectMake(0.0F, 0.0F, 100.0F, 50.0F)];
[scrollView addSubview:button1];
[button1 release];
UIButton *button2 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
[button2 setTitle:@"Button2" forState:UIControlStateNormal];
[button2 setFrame:CGRectMake(100.0F, 0.0F, 100.0F, 50.0F)];
[scrollView addSubview:button2];
[button2 release];
UIButton *button3 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
[button3 setTitle:@"Button3" forState:UIControlStateNormal];
[button3 setFrame:CGRectMake(200.0F, 0.0F, 100.0F, 50.0F)];
[scrollView addSubview:button3];
[button3 release];
UIButton *button4 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
[button4 setTitle:@"Button4" forState:UIControlStateNormal];
[button4 setFrame:CGRectMake(300.0F, 0.0F, 100.0F, 50.0F)];
[scrollView addSubview:button4];
[button4 release];
UIButton *button5 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
[button5 setTitle:@"Button5" forState:UIControlStateNormal];
[button5 setFrame:CGRectMake(400.0F, 0.0F, 100.0F, 50.0F)];
[scrollView addSubview:button5];
[button5 release];
}
you can download source code here
This is app screen shot.
Just remove the release methods from the buttons and you are good to go.
Actually, when you declare the buttons with
UIButton* btn1 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
it is already in auto-release mode as its a class method and not a static method. So you dont need to write
[btn1 release];
Try to use this.
https://github.com/judges/RXCustomTabBar
I have used and its so easy to integrate
You can also try this although i have not tried:
https://github.com/aalittle/ALCustomTabBarController
From the implementation perspective, the most likely candidate seems to be a customized UISegmentedControl, as only one out of Fixtures, League Tables or Latest Score can be active at a time.
However, if the UISegmentedControl cannot be customized to that extent, this can simply be implemented with a series of UIButtons placed beside each other. When the rightmost arrow button is tapped, you can shift the buttons towards the left, and animate this transition.
HTH,
Akshay
精彩评论