有点意思。但又太简单了,没什么技术含量。纯属是学习
注意点:
需要设置
contentSize 活动范围
如果出现设置了contenSize 无法滚动。
需要查看 scrllEnabled 是否设置为NO
是否关闭了交互 等等..
效果图:
代码示例:
//
// SJViewController.m
// 06.OnePieceCodeDemo
//
// Created by SJ.abnormal on 15-1-31.
// Copyright (c) 2015年 SJ.abnormal. All rights reserved.
//
#import "SJViewController.h"
@interface SJViewController ()
@end
@implementation SJViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:self.view.frame];
UIImageView *background = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1920, 1080)];
scrollView.contentSize = background.frame.size;
background.image =[UIImage imageNamed:@"onepiece"];
[scrollView addSubview: background];
[self.view addSubview:scrollView];
}
@end