iPhone 上实现页面循环滚动
2010-03-10 16:10:00 来源:WEB开发网- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{//; // called when scroll view grinds to a halt
[self setScrollPosition];
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{//; // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating
[self setScrollPosition];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{//; // called when scroll view grinds to a halt
[self setScrollPosition];
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{//; // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating
[self setScrollPosition];
}
控制UIView偏移与 UIScrollView offset 位置的实现:
view plaincopy to clipboardprint?
//调整位置
- (void)setScrollPosition
{
if([self isPagingEnabled] == NO)
{
return;
}
if(self.dragging != NO && self.decelerating != NO)
{
return;
}
int x = self.contentOffset.x;
int totalWidth = self.contentSize.width;
int perWidth = self.frame.size.width;
int minStart = 4;
int maxStart = totalWidth - perWidth - 4 ;
if(!(x
{
return;
}
if(totalWidth <= perWidth*2)
{
return;//只有两个元素的情况
}
if(x < minStart || x >maxStart)
{
NSLog(@"self.contentOffset.x=%f",self.contentOffset.x);
// 进入第一步,调整 contextOff 的位置
int nx = 0;
- ››iPhone应用帮助残障儿童看图说话
- ››iPhone实用工具AppBox Pro使用教程大揭秘
- ››iphone4省电方法
- ››iphone 获取地址的详细信息
- ››iPhone 库的基本内存管理策略
- ››iPhone加密文字亲手做 私密信息有保障
- ››iphone 根据经纬度坐标取详细地址(包括国,省,市...
- ››iphone/ipad ios cocoa object-c 近期苹果UI部分小...
- ››iphone中如何进行多线程编程
- ››iPhone OS SDK的这些事[安装、下载、版本、实例、...
- ››iPhone ObjectC的NSAutoreleasePool
- ››iPhone 判断设备是在Portrait(纵向)还是(Landscap...
更多精彩
赞助商链接