开发学院手机开发iPhone 开发 iPhone 上实现页面循环滚动 阅读

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* rc

[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< p>

{

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?

上一页  1 2 3 4 5 6 7  下一页

Tags:iPhone 实现 页面

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接