tags:

views:

76

answers:

3

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.

+1  A: 

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;
Phlibbo
i did n't get it pls post any link consist sample example on it
MaheshBabu
it is good idea.it works fine
MaheshBabu
+1  A: 

hi

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.

iPhone Fun
pls post some sample example link
MaheshBabu
thank u very much it is a good idea. it works fine
MaheshBabu
A: 

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

Toro