0

my application get news from a json address

and i have a image and text

my width textView is dynamic , maybe 100 character maybe 9000 character, and i have a imageView in first of page

i want to scroll all of page (text and image) !

how i can create view to scroll all of them currectly ?

Roohi
  • 1
  • 5

2 Answers2

0

there are lots of tutorials to help you do this. Depending on if you are using storyboards or not.

UIScrollView image/photo viewer with paging enabled and zooming

Basically, once you put your components on the storyboard. You write a class which is a scrollViewController.

You should load your image into a UIImageView, you can do this based on a URL

NSURL * imageURL = [NSURL URLWithString:@"http://192.168.1.2x0/pic/LC.jpg"];
NSData * imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage * image = [UIImage imageWithData:imageData];

Once you have a UIImage object you can resize it etc.

You will also need a json parser as well. Once you parse the data into some kind of datastructure you will be good to go :)

Community
  • 1
  • 1
ddoor
  • 5,819
  • 9
  • 34
  • 41
  • thanks man my problem actually is scroll dynamic text with image.character in each post is changeable,maybe 100 maybe 1000.and cant scroll all of page, – Roohi Aug 24 '12 at 15:33
0

If the data that you receive is unpredictable or very large, I recommend that you use UITableView instead of UIScrollView.

In UITableView, the cells are re-used. Thus, you don't have to worry about the memory related issues with UIScrollView.

Ravi Raman
  • 1,070
  • 9
  • 16