In my app, I have an image view and two buttons, I want to create an array of images, when the app is started, the first image should be displayed, then when the buttons are pressed, the next image or previous image should be displayed(in run time) in the image view.
enter image description here

有帮助吗?

解决方案 2

UIImage* image;
image = [UIImage imageNamed:[NSString stringWithFormat:@"%@ %d",name]];
[array addObject:[NSArray arrayWithObjects:[NSString stringWithFormat:@"%@ %d",name], nil]];

其他提示

You can use a Collection View with paging enabled or a custom image carousel. Check some libraries on Github and see what suits better your needs.

Try to use QuickLook Framework and read articles for it. This is provided by apple itself rather than using the other framework. Also you can try using pageviewController.

http://iosdevelopertips.com/data-file-management/preview-documents-with-qlpreviewcontroller.html

You can also view images from it.

Keep list of images in an Array. initially you will display image at index[0], when you tap on next increment index value by +1 and for previous decrement by -1. this will fix it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top