Tutorial :Suggestions on how to implement a UI Element to display a long image in iPhone



Question:

I want to display a long image on iPhone. The user can swipe left or right to see difficult parts of the image. I want to spite the long image into different parts... for example, a long long image is 1000* 100; I want to display 100*100 for each time. When the image is loaded, it shows from x:0 to x:100. When user swipe right, it becomes x:101, x:200. When the user swipe left, it back to x:0, x:100, when the user continue to swipe right, it show x:201, x:300.

I am thinking how to implement this specified imageView. I have two ideas now. First, make my own imageView, which super class is UIImageView, and overriding the swipe left, swipe right method. Second, make my own UIView. just implement the user swipe left/right action.

Which way you think is better, or any better ideas on implement this? thz u.


Solution:1

Off the top of my head, I would use a UIScrollView and UIPageControl and hook an IBAction to the UIPageControl's value did change event and when that fires, scroll view by 100 or whatever your desired increment is. You'll need to use a couple of the UIScrollView delegate methods as well.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »