A. Function 1. Up and down scrollable Radio 2 x n icon set 2. Top Translucent caption 3. Bottom Translucent Function button B. Implementation ideas 1. Set the icon, Start Screen 2. Drag into the Uiscrollview, set the background color (1) To set contentsize, x=0 prevent horizontal movement of 3. Join the Radio icon (6) 4. Add the top caption and set button to add to the total view, not Uiscrollview (1) Set translucency (2) to add additional scrolling area to the top of the Uiscrollview (not directly using the position down, to achieve the penetration effect of the top header area) , area and top title area position, size consistent (3) initialize Uiscrollview set the start of the scroll position contentoffset, do not rise to the top of the title area at the beginning (4) status bar height 20 units, note the title and button position
1 //get the bottom y value2CGFloat Maxy =Cgrectgetmaxy (self.lastImage.frame);3 4 //set the horizontal direction not to roll, scroll vertically to the bottom5Self.scrollView.contentSize = Cgsizemake (0, Maxy);6 7 //set top, bottom interval8Self.scrollView.contentInset = Uiedgeinsetsmake ( -,0, -,0);9 Ten //set the initial scroll position OneSelf.scrollView.contentOffset = Cgpointmake (0, - -);
5. Add the bottom button (1) using Cgrectgetmaxy and other methods to get the lowest position at the bottom to set contentsize 6. Add bottom Function button Area main code
1 //2 //VIEWCONTROLLER.M3 //Radio4 //5 //Created by Hellovoidworld on 14/11/28.6 //Copyright (c) 2014 Hellovoidworld. All rights reserved.7 //8 9 #import "ViewController.h"Ten One @interfaceViewcontroller () A@property (Weak, nonatomic) Iboutlet Uiscrollview *ScrollView; -@property (Weak, nonatomic) Iboutlet UIButton *Lastimage; - the @end - - @implementationViewcontroller - +- (void) Viewdidload { - [Super Viewdidload]; + //additional setup after loading the view, typically from a nib. A at [self initscrollview]; - } - -- (void) didreceivememorywarning { - [Super didreceivememorywarning]; - //Dispose of any resources the can be recreated. in } - to- (void) Initscrollview { + //get the bottom y value -CGFloat Maxy =Cgrectgetmaxy (self.lastImage.frame); the * //set the horizontal direction not to roll, scroll vertically to the bottom $Self.scrollView.contentSize = Cgsizemake (0, Maxy);Panax Notoginseng - //set top, bottom interval theSelf.scrollView.contentInset = Uiedgeinsetsmake ( -,0, -,0); + A //set the initial scroll position theSelf.scrollView.contentOffset = Cgpointmake (0, - -); + } - $ @end
[iOS basic Control-5.3] Radio app scrollable main interface (Uiscrollview production)