1. Put the image in the images folder and rename it images. bundle. drag it into the project.
2. Drag scrollView and hold down Scroll View in the upper left corner to drag it to View Controller and select deleagte. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + partition = "http://www.2cto.com/uploadfile/Collfiles/20140627/2014062709114672.jpg" alt = "\">
Add a proxy to the specified controller.
#import
@interface CSZViewController : UIViewController
//ViewPager@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;@end
@ Implementation CSZViewController-(void) viewDidLoad {[super viewDidLoad]; int width = self. view. frame. size. width; int height = self. view. frame. size. height; // obtain the content path of multiple pages from the bundle compressed file NSString * bundlePath = [[NSBundle mainBundle] pathForResource: @ "images" ofType: @ "bundle"]; NSBundle * bundle = [[NSBundle alloc] initWithPath: bundlePath]; self. imagesArr = [bundle pathsForResourcesOfType: @ "jpg" inDirectory: nil]; self. scrollView. contentSize = CGSizeMake (self. imagesArr. count * width, height); // create a page for (int I = 0; I