Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uiscrollview not scrolling horizontally

My UIScrollView below is not scrolling horizontally, Please help me here..

FirstView = [[UIView alloc] initWithFrame:CGRectMake(60, 0, 100, 150)];
    [FirstView setBackgroundColor:[UIColor clearColor]];

    SecondView = [[UIView alloc] initWithFrame:CGRectMake(320+60, 0, 100, 150)];
    [SecondView setBackgroundColor:[UIColor clearColor]];

    HolderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1000, 150)];

    scrHorizontalScroll = [[UIScrollView alloc]initWithFrame:HolderView.frame];
        [scrHorizontalScroll setBackgroundColor:[UIColor redColor]];
    [scrHorizontalScroll setContentSize:CGSizeMake(999, 150)];
    [scrHorizontalScroll setScrollEnabled:YES];
    [HolderView addSubview:scrHorizontalScroll];
[scrHorizontalScroll addSubView:FirstView]; [scrHorizontalScroll addSubView:SecondView]; [HolderView addSubView: scrHorizontalScroll];

The HolderView is not scrolling horizontally but which happen, please help

Note: I have a mainView which adds this HolderView in its top section as per the frame coordinates.

[mainView addSubView:label].... [mainView addSubView:HolderView];

This is complete structure

like image 351
Futur Avatar asked May 01 '10 00:05

Futur


1 Answers

A scroll view will only scroll when its content size is bigger than its frame.

like image 132
Tom Irving Avatar answered Oct 22 '22 17:10

Tom Irving