Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 views
in Technique[技术] by (71.8m points)

iphone - How to create a UIScrollView of infinite scrolling?

  1. I have a UIScrollView of size 320*460 and with content size 1024*1024.
  2. I can place 25 images of 256*256 in it with the 13th picture shown at the centre of the screen when it loades with bits of surrounding pictures around it.
  3. When i swipe to any side I want it to appear just like the mapView. With new images appearing and showing.

How can I do it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It's very easy & somewhat tricky...

You don't need to define the specific size for the ScrollView.....

Generally we use to define ....as per the Examples of Apple

//#define SCROLLVIEW_CONTENT_HEIGHT 460

//#define SCROLLVIEW_CONTENT_WIDTH  320

which is of no use...if you need the infinite height..

just set the height of the ScrollView dynamically as per the Objects added to the ScrollView....

No need to set the predefined height for this...take the dynamic height....

scrollview.contentSize = CGSizeMake(320, txtView.contentSize.height+450);
 CGPoint topOffset = CGPointMake(0,0);
 [scrollview setContentOffset:topOffset animated:YES];

Hope this will surely work for you..

Good Luck :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...