- (void)viewDidLoad {
[super viewDidLoad];
NSArray *segmentedArray = [[NSArray alloc]initWithObjects:@"推荐",@"最新",nil];
//初始化UISegmentedControl
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc]initWithItems:segmentedArray];
segmentedControl.frame = CGRectMake(157,20,100,40);
//设置默认选择项索引
segmentedControl.selectedSegmentIndex = 2;
segmentedControl.tintColor = [UIColor whiteColor];
[self.view addSubview:segmentedControl];
}