UI控件(UIScrollView)

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad]; //创建一个scrollview
UIScrollView *_scrollview = [[UIScrollView alloc]init];
_scrollview.frame = CGRectMake(,,,);
_scrollview.backgroundColor = [UIColor grayColor];
[self.view addSubview:_scrollview]; UIImageView *bgimage = [[UIImageView alloc]init];
bgimage.image = [UIImage imageNamed:@"guide.png"];
CGFloat height = bgimage.image.size.height;
CGFloat width = bgimage.image.size.width;
bgimage.frame = CGRectMake(, , width, height);
[_scrollview addSubview:bgimage]; //scrollview滑动的范围,加上此句后出现水平及纵向拖动条
_scrollview.contentSize = bgimage.image.size; //拖动到结束时增加弹簧效果
_scrollview.bounces = TRUE; //水平拖动条显示
_scrollview.showsHorizontalScrollIndicator = YES;
//垂直拖动条显示
_scrollview.showsVerticalScrollIndicator = YES; //拖动条的风格
// UIScrollViewIndicatorStyleDefault, 默认风格
// UIScrollViewIndicatorStyleBlack, 黑色风格
// UIScrollViewIndicatorStyleWhite 白色风格
_scrollview.indicatorStyle = UIScrollViewIndicatorStyleWhite; _scrollview.pagingEnabled = YES; } @end
上一篇:【Linux】Linux系统dev/目录下的tty


下一篇:EJDB 1.1.18 发布,嵌入式JSON数据库