UIScrollView *m_scView;
代理:<UIScrollViewDelegate>
self.m_scView.delegate = self;
1.设置大小
m_scView.contentSize = CGSizeMake(200, 0); //宽设为200,高度设置为0,禁止了垂直滚动
2.设置滑块的位置
self.m_scView.contentOffset = CGPointMake(self.m_scView.frame.size.width, 0);
3.不显示垂直滚动条
m_scView.showsVerticalScrollIndicator = false;
4.在滑动条里面添加视图
prayertimePageViewController *m_controller=[[prayertimePageViewController alloc]initWithNibName:@"prayertimePageViewController_iPad" bundle:nil];
if ((NSNull *)m_controller == [NSNull null])
{
[m_controller release];
}
// add the controller's view to the scroll view
if (m_controller.view.superview == nil)
{
CGRect frame = m_scView.frame;
frame.origin.x = frame.size.width * num;
frame.origin.y = 0;
m_controller.view.frame = frame;
[m_scView addSubview:m_controller.view];
}
5.滑动开始前
//scrollview滑动开始前
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
}
6.scrollview滑动结束后
//scrollview滑动结束后
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
}
代理:<UIScrollViewDelegate>
self.m_scView.delegate = self;
1.设置大小
m_scView.contentSize = CGSizeMake(200, 0); //宽设为200,高度设置为0,禁止了垂直滚动
2.设置滑块的位置
self.m_scView.contentOffset = CGPointMake(self.m_scView.frame.size.width, 0);
3.不显示垂直滚动条
m_scView.showsVerticalScrollIndicator = false;
4.在滑动条里面添加视图
prayertimePageViewController *m_controller=[[prayertimePageViewController alloc]initWithNibName:@"prayertimePageViewController_iPad" bundle:nil];
if ((NSNull *)m_controller == [NSNull null])
{
[m_controller release];
}
// add the controller's view to the scroll view
if (m_controller.view.superview == nil)
{
CGRect frame = m_scView.frame;
frame.origin.x = frame.size.width * num;
frame.origin.y = 0;
m_controller.view.frame = frame;
[m_scView addSubview:m_controller.view];
}
5.滑动开始前
//scrollview滑动开始前
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
}
6.scrollview滑动结束后
//scrollview滑动结束后
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
}