开发者

image array in xcode [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

Improve this question 开发者_如何学运维

i am new to iphone programming, i want to put multiple images for slideview..and for that i want to declare it by array and use it in same viewcontroller class..so anybody can tell me how to declare the array of images in a class and display


BoYo's solution is fine if you have just a few images, but more than a few images will require a more sophisticated solution, particularly if the images are at higher resolution (as you'll need if you want to be able to zoom in). Images can consume a lot of memory, so you'll want a strategy for loading only the images you need at any given moment and unloading them as you no longer need them. UIScrollView provides for tiling the content, so you can provide the scrolling content just a little at a time. That lets you keep only what you need in memory while still giving decent scrolling performance.

Take a look at the PhotoScroller sample code to see how this can be done well.


One solution for the scrollview is to create an UIImageView for every picture you want to add to your scrollview and then add them as subviews to your scrollview.
As far as for the tap part - you can create your own GestureRecognizer for the tap action and set anything you want to do with the selected image. Also try to change minzoom and maxzoom of the scrollview's contentview and zoom action will be added automatically for you.


NSArray *images = [NSArray arrayWithObjects:
                   [UIImage imageNamed:@"1.png"],
                   [UIImage imageNamed:@"2.png"],
                   [UIImage imageNamed:@"3.png"],
                   [UIImage imageNamed:@"4.png"],
                   [UIImage imageNamed:@"5.png"],
                   nil];      
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜