iPhone 上实现页面循环滚动
2010-03-10 16:10:00 来源:WEB开发网[sview addSubview:pView];
[pView release];
rc.origin.x += perWidth;
pView.font = [UIFont systemFontOfSize:40];
pView.tag = 0x12345691;
}
rcSize.width = nViewCount* rcSize.width;
sview.contentSize = rcSize;
sview.pagingEnabled = YES;
sview.bounces = NO;
CGPoint contextOff = {300,0};
[sview setContentOffset:contextOff animated:NO];
}
-(void)setUpViews:(ExScrollView*)sview
{
CGRect dddd = [sview frame];
CGSize rcSize = dddd.size;
int nViewCount = 3;
int perWidth = rcSize.width;
CGRect rc = CGRectMake(0, 0, perWidth, rcSize.height);
UIColor* color[6];
color[0] = [UIColor brownColor];
color[1] = [UIColor purpleColor];
color[2] = [UIColor orangeColor];
color[3] = [UIColor magentaColor];
color[4] = [UIColor yellowColor];
color[5] = [UIColor cyanColor];
int i=0;
for(;i
{
UITextView* pView = [[UITextView alloc] initWithFrame:rc];
UIColor* pColor = color[i%5];
pView.backgroundColor = pColor;
pView.text = [NSString stringWithFormat:@"%view:%d",i+1];
pView.editable = NO;
[sview addSubview:pView];
[pView release];
rc.origin.x += perWidth;
pView.font = [UIFont systemFontOfSize:40];
pView.tag = 0x12345691;
}
rcSize.width = nViewCount* rcSize.width;
sview.contentSize = rcSize;
sview.pagingEnabled = YES;
sview.bounces = NO;
CGPoint contextOff = {300,0};
[sview setContentOffset:contextOff animated:NO];
}
UIScrollView的代理接口实现:
view plaincopy to clipboardprint?
- ››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...
更多精彩
赞助商链接