Last active
August 29, 2015 14:10
-
-
Save matrixfox/8fd74338c7529d516692 to your computer and use it in GitHub Desktop.
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
- (void)viewDidLoad | |
{ | |
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] | |
initWithItems:[NSArray arrayWithObjects: | |
@"Segm 1", | |
@"Segm 2", | |
@"Segm 3", | |
@"Segm 4", nil]]; | |
[segmentedControl setFrame:CGRectMake(20, 20, [UIScreen mainScreen].bounds.size.width - 40, 30)]; | |
[segmentedControl setSelectedSegmentIndex:0]; | |
[segmentedControl setTintColor:[UIColor greenColor]]; | |
[self.view addSubview:segmentedControl]; | |
if(segmentedControl.selectedSegmentIndex == 0){ | |
NSLog(@"Red"); | |
} else if (segmentedControl.selectedSegmentIndex == 1) { | |
NSLog(@"Blue"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment