美文网首页
IOS学习之 -- UIScrollView

IOS学习之 -- UIScrollView

作者: 就怕是个demo | 来源:发表于2015-11-20 19:36 被阅读31次
#import "ViewController.h"

@interface ViewController ()
@property (strong, nonatomic) IBOutlet UIScrollView *myScorllView;
@property (strong, nonatomic) IBOutlet UIImageView *image;

@end

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"a.jpg"]];
    self.myScorllView = [[UIScrollView alloc]initWithFrame:self.view.bounds];
    //重要的一项设置
    self.myScorllView.contentSize = self.image.bounds.size;
    [self.myScorllView addSubview:self.image];
    [self.view addSubview:self.myScorllView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

相关文章

网友评论

      本文标题:IOS学习之 -- UIScrollView

      本文链接:https://www.haomeiwen.com/subject/lqwlhttx.html