Scrolling view the principle of multi-page implementation the position of the scroll view position changes when the content is unchanged.
Application of Scrolling view 1. View the picture by paging 2. See the big picture 3. When too much content needs a page display, such as: registration, modify personal information and so on 4. When you don't want the user to feel that our interface is a picture ...
When you set the contentsize of a scrolling view, contentsize is not scrolled if the bounds is smaller than the scroll view
Setting the contentsize of a scrolling view is the same as the size of the picture
Scrollview.contentsize =bgimg.size;
Add a picture on a scrolling view (add content on a scrolling view)
Imgview =[[uiimageview alloc]initwithframe:cgrectmake (0, 0, Bgimg.size.width, bgimg.size.height)];
Imgview.image = bgimg;
[ScrollView Addsubview:imgview];
Add ScrollView to Self.view and run the simulator to see the big picture.
2. When we need to zoom in and out of large images
Set the zoom multiplier of a scrolling view
Scrollview.minimumzoomscale = 0.5;
Scrollview.maximumzoomscale = 2;
Use the agent method of scrolling view, need to hang up agent
Scrollview.delegate =self;
Set up a view that needs to be enlarged in a scrolling view
-(UIView *) Viewforzoominginscrollview: (Uiscrollview *) scrollview{
return imgview;
}
Note: You do not need to initialize the window in the appdelegate when writing the above code.
Import Agent:
Ios-ui-uiscrollview scrolling View (1)