IOS UIScrollView in UIView?

Ok, hacky code follows, so ignore all my other issues, but follow this pattern (westie. Jpg = image that was 360x200) interface MyView : UIView { UIScrollView *sv; UILabel *l; } -(MyView*)initWithFrame:(CGRect)frame; @end @implementation MyView -(MyView*)initWithFrame:(CGRect)frame; { self = super initWithFrame:frame; sv = UIScrollView alloc initWithFrame:CGRectMake(0,0,360,200); sv. ScrollEnabled = YES; sv.

ContentSize = CGSizeMake(360*3,200); self addSubview:sv; UIImage *i1 = UIImage imageNamed:@"westie. Jpg"; UIImageView *iv1 = UIImageView alloc initWithImage:i1; iv1. Frame = CGRectMake(360*0, 0, 360, 200); sv addSubview:iv1; UIImageView *iv2 = UIImageView alloc initWithImage:i1; iv2.

Frame = CGRectMake(360*1, 0, 360, 200); sv addSubview:iv2; UIImageView *iv3 = UIImageView alloc initWithImage:i1; iv3. Frame = CGRectMake(360*2, 0, 360, 200); sv addSubview:iv3; l = UILabel alloc initWithFrame:CGRectMake(10, 10, 100, 20); l. Text = @"BackgroundColor = UIColor blueColor; self addSubview:l; return self; } end later, in your outer view creation: window addSubview:MyView alloc initWithFrame:CGRectMake(0, 20, 360, 200).

Ok, hacky code follows, so ignore all my other issues, but follow this pattern (westie. Jpg = image that was 360x200) @interface MyView : UIView { UIScrollView *sv; UILabel *l; } -(MyView*)initWithFrame:(CGRect)frame; @end @implementation MyView -(MyView*)initWithFrame:(CGRect)frame; { self = super initWithFrame:frame; sv = UIScrollView alloc initWithFrame:CGRectMake(0,0,360,200); sv. ScrollEnabled = YES; sv.

ContentSize = CGSizeMake(360*3,200); self addSubview:sv; UIImage *i1 = UIImage imageNamed:@"westie. Jpg"; UIImageView *iv1 = UIImageView alloc initWithImage:i1; iv1. Frame = CGRectMake(360*0, 0, 360, 200); sv addSubview:iv1; UIImageView *iv2 = UIImageView alloc initWithImage:i1; iv2.

Frame = CGRectMake(360*1, 0, 360, 200); sv addSubview:iv2; UIImageView *iv3 = UIImageView alloc initWithImage:i1; iv3. Frame = CGRectMake(360*2, 0, 360, 200); sv addSubview:iv3; l = UILabel alloc initWithFrame:CGRectMake(10, 10, 100, 20); l. Text = @"BackgroundColor = UIColor blueColor; self addSubview:l; return self; } @end later, in your outer view creation: window addSubview:MyView alloc initWithFrame:CGRectMake(0, 20, 360, 200).

It was strange for me, because when I usually create a UIScrollView and add it to the UIViewController's view it has bounces and scroll bar disappears immediately when it stops. I tried to change UIScrollView's properties, such as directionalLockEnabled, pagingEnabled, canCancelContentTouches, delaysContentTouches, decelerationRate and others. In fact, I have tried to change almost all properties of UIScrollView but I could not get the scroll bars to immediately disappear.

If I try to add UIScrollView instead MyView to the UIViewController. View, it bounces and scroll bar disappears immediately after it stops. Also I get correct behavior if I subclass MyView from UIScrollView but in this case I cannot manage the title label because it scrolls together with other content.

Do you know why I am seeing this behavior? How can I get "usual" behavior for scroll encapsulated by UIView?

Ok, hacky code follows, so ignore all my other issues, but follow this pattern (westie. Jpg = image that was 360x200).

Ok, hacky code follows, so ignore all my other issues, but follow this pattern (westie. Jpg = image that was 360x200) @interface MyView : UIView { UIScrollView *sv; UILabel *l; } -(MyView*)initWithFrame:(CGRect)frame; @end @implementation MyView -(MyView*)initWithFrame:(CGRect)frame; { self = super initWithFrame:frame; sv = UIScrollView alloc initWithFrame:CGRectMake(0,0,360,200); sv. ScrollEnabled = YES; sv.

ContentSize = CGSizeMake(360*3,200); self addSubview:sv; UIImage *i1 = UIImage imageNamed:@"westie. Jpg"; UIImageView *iv1 = UIImageView alloc initWithImage:i1; iv1. Frame = CGRectMake(360*0, 0, 360, 200); sv addSubview:iv1; UIImageView *iv2 = UIImageView alloc initWithImage:i1; iv2.

Frame = CGRectMake(360*1, 0, 360, 200); sv addSubview:iv2; UIImageView *iv3 = UIImageView alloc initWithImage:i1; iv3. Frame = CGRectMake(360*2, 0, 360, 200); sv addSubview:iv3; l = UILabel alloc initWithFrame:CGRectMake(10, 10, 100, 20); l. Text = @"backgroundColor = UIColor blueColor; self addSubview:l; return self; } @end later, in your outer view creation: window addSubview:MyView alloc initWithFrame:CGRectMake(0, 20, 360, 200).

Up vote 2 down vote favorite share g+ share fb share tw.

I have a little bit specific question. May be it does not matter for mostly people but I have faced with it and I had to solve issue described below. I tried to find some information about it in the Google and Apple SDK documentation but did not succeed.

I had screen in design where was many images in horizontal scrolls. There was three same scrolls. Every scroll had title.

I have implemented custom class derived from UIView and placed there UIScrollView for scroll and UILabel for title text. @interface MyView : UIView { UIScrollView *iScrollView; UIView *iTitleView; } I have putted objects of this class on the view of UIViewController view @implementation MyViewController - (void) viewDidLoad { super viewDidLoad; ... iScrollViewTop = MyView alloc init; self. View addSubview:iScrollViewTop; ... } @end When I filled internal scroll view with images and run my application it looked OK.

But. Where was a little bit strange behavior. At first, scroll did not have bounces as if I set iScrollView.

Bounces = NO; and at second, when I swiped scroll, when scroll stopped scroll bar does not disappear within one second. It was strange for me, because if I usually create UIScrollView and add it to the UIViewController's view it has bounces and scroll bar disappears immediately when it stops. I tried to change UIScrollView's properties, such as directionalLockEnabled, pagingEnabled, canCancelContentTouches, delaysContentTouches, decelerationRate and other, I have tried to change almost all properties of UIScrollView but I could not get scroll immediately disappear.

If I try to add UIScrollView instead MyView to the UIViewController. View scroll has bounces and scroll bar disappears immediately after stop. Also I get correct behavior if I derive MyView from UIScrollView but in this case I can not to manage title label because it scrolls together with other content.

Actually, questions. Do you know why it behaves this way. How can I get "usual" behavior for scroll encapsulated by UIView.

Ios uiview uiscrollview link|improve this question edited Apr 13 '11 at 17:13Anna Karenina16.3k22128 asked Apr 13 '11 at 16:11Rost764.

I get the same behavior from a UIScrollView-derived class, but only in iOS 5. It works fine in 4. X – Ralfonso Jan 21 at 2:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions