ScrollView的使用
来源:互联网 发布:桌游淘宝 编辑:程序博客网 时间:2024/06/05 20:36
本文主要介绍scrollView的使用,使用scrollView来做一个手机相册。
内容不多,直接上代码
#import "RootViewController.h"#define Kwidth _scrollView.frame.size.width #define kHight _scrollView.frame.size.height@interface RootViewController ()@property(nonatomic,retain)UIScrollView * scrollView;@end@implementation RootViewController- (void)viewDidLoad { [super viewDidLoad]; self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(30, 100, 320, 480)]; self.view.backgroundColor = [UIColor whiteColor]; _scrollView.backgroundColor = [UIColor greenColor]; [self.view addSubview:_scrollView]; _scrollView.contentSize = CGSizeMake(19*Kwidth,kHight); for (int i = 0; i<19; i++) { NSString *imageName = [NSString stringWithFormat:@"image%d.jpg",i+1]; UIImage *image = [UIImage imageNamed:imageName]; UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(i*Kwidth, 0, Kwidth, kHight)]; imageView.image = image; [_scrollView addSubview:imageView]; [imageView release]; } _scrollView.pagingEnabled = YES; [_scrollView release]; // Do any additional setup after loading the view.}
0 0
- Android ScrollView的使用
- scrollView的使用
- cocostudio Scrollview的使用
- Android ScrollView的使用
- scrollview的使用
- UI-ScrollView的使用
- ScrollView的使用
- Masonry+ScrollView的使用
- ScrollView的使用
- scrollView的使用
- scrollview 的使用
- Android ScrollView的使用
- scrollView 的使用
- Android的ScrollView使用
- ScrollView的使用
- ScrollView的使用详细
- Android ScrollView的使用
- 组件ScrollView的使用
- C# SQLserver数据库图片存取
- Qt 学习之路 2(15):标准对话框 QMessageBox
- vs2008 试用版评估期结束的解决方法 .
- 单词数set<string>
- 数据结构之字符串的模式匹配
- ScrollView的使用
- Rust之开始入门<3>
- 面向对象的三个基本元素与五大基本原则
- 二维数组作为参数传递问题
- ios开发学习---一些概念的简介
- Git 常用命令详解
- 设计模型之二策略模式
- 类方法和对象方法的比较
- Excel和SQLserver数据互相存取