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

--------------Solutions-------------

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

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, 100, 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];

//set with of the scrHorizontalScroll as second view,increase content view size to x axis.

Category:iphone Time:2010-05-01 Views:0

Related post

  • UIScrollView scrolling horizontal and vertical programmatically 2011-12-09

    I want to use UIScrollView in my application, which vertically scrolls pages of individual chapter and horizontally scrolls chapters of a book/magazine. i can scroll vertically but how can i scroll horizontally using the same scrollview. ------------

  • How do I stop a UIScrollView from bouncing horizontally? 2008-10-06

    I have a UIScrollView that shows vertical data, but where the horizontal component is no wider than the screen of the iPhone. The problem is that the user is still able to drag horizontally, and basically expose blank sections of the UI. I have tried

  • UIScrollView not scrolling when set to a tableView's tableHeaderView 2009-05-19

    I'm having difficulty scrolling a UIScrollView instance in my UITableView when I set it as a tableHeaderView. It still responds to touch events it appears, but doesn't wish to scroll horizontally. I've tried explicitly setting to setUserInteractionEn

  • Programatically pass touches to UIScrollView to scroll 2010-03-10

    So basically I'm trying to make UIScrollView only scroll on higher angles. As in right now if you move your finger 10 degrees off horizontal, the scrollview will scroll. I'd like to push that up to, say, 30 degrees. After doing some reading, I establ

  • UIScrollView Infinite Scrolling 2010-08-07

    I'm attempting to setup a scrollview with infinite (horizontal) scrolling. Scrolling forward is easy - I have implemented scrollViewDidScroll, and when the contentOffset gets near the end I make the scrollview contentsize bigger and add more data int

  • How to stop a UITableview from scrolling horizontally? 2010-10-28

    For some reason my iOS UITableView is scrolling horizontally. Any ideas why this may happen? Thanks. Edit: It seems to be the result of repositioning the table in code with screen reorientation. So I guess the question is: how do I reposition the tab

  • TableViewController for scrolling horizontally 2011-04-11

    I need a tableviewcontroller that scrolls horizontally instead of vertically. Is there one available? Because I have to use a scrollview now which might get memory hungry after a while! --------------Solutions------------- We have used UIScrollView f

  • UIKit: UIScrollView automatically scrolling when a subview increases its width past the edge of the screen 2011-06-04

    In the context of the iPhone: I have a UIScrollView containing a UIImage. When the user taps the screen inside the UIImage, a UITextField is added where the user touched. The user can edit this UITextField, and the text field will automatically resiz

  • iOS: Can I have a UITableView scrolling horizontally in the iPhone landscape mode ? 2011-08-07

    Possible Duplicate: Horizontal scrolling UITableView Can I have a UITableView scrolling horizontally in the iPhone landscape mode ? This is how it looks like now: http://cl.ly/95xZ This is how it should be: http://cl.ly/93IY I was wondering if I shou

  • Scrolling horizontally in the tableview along with normal vertical scroll 2011-09-13

    I have a requirement which lists the Cricket players in a table view with thier names and their stats like the following Name total 4's 6's 1's average Tendulkar 231 O 6 5 3.6 Gangully 212 9 0 8 4.5 the total number of stats is like 8 to 10 , for tha

  • How to know exactly when a UIScrollView's scrolling has stopped? 2011-10-06

    In short, I need to know exactly when the scrollview stopped scrolling. By 'stopped scrolling', I mean the moment at which it is no longer moving and not being touched. I've been working on a horizontal UIScrollView subclass (for iOS 4) with selectio

  • UIScrollView : only paging horizontally left, bouncing right 2012-01-26

    How can I force a UIScrollView in which paging and scrolling are on to only move horizontally left or horizontally both direction(left and right)? To be clearer, I'd like to allow the user to 'page only horizontally backward(only bounce when the user

  • Tell UIScrollView to scroll to the top 2012-02-26

    How do I tell a UIScrollView to scroll to the top? Thanks for your help. --------------Solutions------------- UPDATE FOR iOS 7 [self.scrollView setContentOffset: CGPointMake(0, -self.scrollView.contentInset.top) animated:YES]; ORIGINAL [self.scrollVi

  • "Fixing" the first few columns in an SWT table to prevent them from scrolling horizontally 2009-03-02

    We have implemented a table-based editor with an SWT tree table. It pretty much does what we want it to, except that we can't find a way to ensure that the first few columns remain at their position when the user scrolls horizontally (so that one can

  • Drawing a shadow below a UIScrollView (that scrolls a UIView) 2009-06-05

    My setup is a UIScrollView in the center of the screen (on the iPhone - like 300x400 positioned in the center) that contains a UIView of the same width, so it scrolls it vertically. In this UIView i draw custom subviews with labels etc (it's a scoreb

  • Why isn't my div scrolling horizontally when adding multiple images? 2010-03-10

    I have an outer div, and inside of that, I have an inner div which contains a list of images. When the images are wider than the outer div, I want to have it scroll horizontally, but instead, it just puts the image on the next line instead of expandi

  • CSS: background absent when scrolling horizontally 2010-03-11

    OK I have backgrounds set up like this: HTML <div id="container"> <div id="content"> CONTENT HERE </div> </div> CSS #container { background:url(image.gif); } #content { width:800px; margin:auto; } So the idea is for the conten

  • that only scrolls horizontally? 2010-06-13

    How can I create a element that only scrolls horizontally? If it makes sense, I want the element to act like it is position:fixed when the user scrolls vertically down the page, but act like it's position:static for sideways scrolling. HTML/CSS solut

  • Prevent UISCrollView to scroll unless it was touched near edges 2010-09-03

    I have the following situation: A UIScrollView contains a UIWebView. I want the content inside the web view to be touchable, but the scroll view should not scroll unless it was touched near the left or right edge. I have subclassed both UIScrollView

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.488 (s). 13 q(s)