1

hi i am new to iphone.I need to scroll scrollview horizontally instead of vertical.Is it possible to scroll horizontally.If it possible pls post link consist sample example.Thank u in advance.

Mahesh Babu
  • 3,395
  • 9
  • 48
  • 97

3 Answers3

2

you can use following code

[myscrollview addSubview:imgButton];

x = frame.origin.x; y = frame.origin.y+80;

[myscrollview setContentSize:CGSizeMake(x,y)];

in that each time you add a new button/Image increase content size Y position and also make set scroll vertical false.

EDIT: Here is the link to your question.

Community
  • 1
  • 1
V.V
  • 3,082
  • 7
  • 49
  • 83
1

It's hard to answer you without a concrete example. In general, the scrolling directions of a UIScrollView are defined by it's "contentSize" property. So if you have a label (myLabel) which is wider than your scrollView (myScrollview) you could write this:

myScrollview.contentSize = CGSizeMake(myLabel.frame.size.width, myScrollview.frame.size.height);
//Next line is rather optional, should be already set by default
myScrollview.scrollEnabled = YES;
Philipp Schlösser
  • 5,179
  • 2
  • 38
  • 52
0

If you want an example, here the sample codes are. As Phlibbo said, the contentSize of scrollView will decide the direction of that.

AechoLiu
  • 17,522
  • 9
  • 100
  • 118