标签:style blog http io ar color os 使用 sp
1 // 取得最底端的Y值 2 CGFloat maxY = CGRectGetMaxY(self.lastImage.frame); 3 4 // 设置水平方向不可滚,垂直方向可滚动到最底端 5 self.scrollView.contentSize = CGSizeMake(0, maxY); 6 7 // 设置顶部、底部间隔 8 self.scrollView.contentInset = UIEdgeInsetsMake(55, 0, 70, 0); 9 10 // 设置初始滚动位置 11 self.scrollView.contentOffset = CGPointMake(0, -55);
1 // 2 // ViewController.m 3 // Radio 4 // 5 // Created by hellovoidworld on 14/11/28. 6 // Copyright (c) 2014年 hellovoidworld. All rights reserved. 7 // 8 9 #import "ViewController.h" 10 11 @interface ViewController () 12 @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; 13 @property (weak, nonatomic) IBOutlet UIButton *lastImage; 14 15 @end 16 17 @implementation ViewController 18 19 - (void)viewDidLoad { 20 [super viewDidLoad]; 21 // Do any additional setup after loading the view, typically from a nib. 22 23 [self initScrollView]; 24 } 25 26 - (void)didReceiveMemoryWarning { 27 [super didReceiveMemoryWarning]; 28 // Dispose of any resources that can be recreated. 29 } 30 31 - (void) initScrollView { 32 // 取得最底端的Y值 33 CGFloat maxY = CGRectGetMaxY(self.lastImage.frame); 34 35 // 设置水平方向不可滚,垂直方向可滚动到最底端 36 self.scrollView.contentSize = CGSizeMake(0, maxY); 37 38 // 设置顶部、底部间隔 39 self.scrollView.contentInset = UIEdgeInsetsMake(55, 0, 70, 0); 40 41 // 设置初始滚动位置 42 self.scrollView.contentOffset = CGPointMake(0, -55); 43 } 44 45 @end
[iOS基础控件 - 5.3] 电台APP可滚动主界面(UIScrollView制作)
标签:style blog http io ar color os 使用 sp
原文地址:http://www.cnblogs.com/hellovoidworld/p/4129823.html