#pragma mark 滑动轮播图 segment选中当前轮播图显示的页面
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
_segmentTittles.selectedSegmentIndex = targetContentOffset->x / self.view.frame.size.width;
}
#pragma mark 点击segment跳转到轮播图指定页面
- (IBAction)segmentBtnClick:(UISegmentedControl *)sender {
_scrollView.contentOffset = CGPointMake(sender.selectedSegmentIndex * self.view.frame.size.width, 0);
}
- (void)segmentChangedValue:(id)sender {
switch([(UISegmentedControl *)sender selectedSegmentIndex])
{
case 0:
[viewSelectedController_.view removeFromSuperview];
[self.view addSubview:viewAllController_.view];
break;
case 1:
[viewAllController_.view removeFromSuperview];
[self.view addSubview:viewSelectedController_.view];
break;
default:
break;
}
}