Created
October 22, 2011 17:39
-
-
Save sumardi/1306262 to your computer and use it in GitHub Desktop.
iPhoneDev - Multiple buttons on navigation bar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray array]]; | |
| [segmentedControl setMomentary:YES]; | |
| [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"191-Up.png"] atIndex:0 animated:NO]; | |
| [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"191-Down.png"] atIndex:1 animated:NO]; | |
| segmentedControl.autoresizingMask = UIViewAutoresizingNone; | |
| segmentedControl.frame = CGRectMake(0.0f, 0.0f, 90.0f, 30.0f); | |
| segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar; | |
| [segmentedControl addTarget:self action:@selector(pagingAction:) forControlEvents:UIControlEventValueChanged]; | |
| UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl]; | |
| self.navigationItem.rightBarButtonItem = segmentBarItem; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment