#pragma mark-添加两个子控制器
- (void)setUpChildViewController {
HHShoppingOrdorViewController *shoppingOrdorVC = [[HHShoppingOrdorViewController alloc] init];
HHListenOrdorViewController *listenOrdorVC = [[HHListenOrdorViewController alloc] init];
[self addChildViewController:shoppingOrdorVC];
[self addChildViewController:listenOrdorVC];
[shoppingOrdorVC didMoveToParentViewController:self];
[listenOrdorVC didMoveToParentViewController:self];
shoppingOrdorVC.view.frame = CGRectMake(0,
0,
self.scrollView.width,
self.scrollView.height);
listenOrdorVC.view.frame = CGRectMake(self.scrollView.width,
0,
self.scrollView.width,
self.scrollView.height);
[self.scrollView addSubview:shoppingOrdorVC.view];
[self.scrollView addSubview:listenOrdorVC.view];
_shoppingOrdorVC = shoppingOrdorVC;
_listenOrdorVC = listenOrdorVC;
}
- (UIScrollView *)scrollView {
if (!_scrollView) {
CGFloat scrollView_y = isPad?64:44;
CGRect frame = CGRectMake(0, scrollView_y, self.view.width, self.view.height-scrollView_y);
_scrollView = [[UIScrollView alloc] init];
_scrollView.autoresizesSubviews=YES;
_scrollView.autoresizingMask=UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
_scrollView.frame = frame;
_scrollView.delegate = self;
_scrollView.backgroundColor = [UIColor clearColor];
_scrollView.contentSize = CGSizeMake(_scrollView.width * 2, 0);
_scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.bounces = NO;
_scrollView.pagingEnabled = YES;
_scrollView.scrollEnabled = NO;
[self.view addSubview:_scrollView];
}
return _scrollView;
}