Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4553782
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:59:44+00:00 2026-05-21T16:59:44+00:00

I have a little bit specific question. It might not matter for most people

  • 0

I have a little bit specific question. It might not matter for most people but I have had to deal with it and I had to solve the issue described below. I tried to find some information about it using Google and the Apple SDK documentation but did not succeed.

I was a designing a screen where there were many images in horizontal scrolls. There three 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 then put objects of this class on the view of a UIViewController:

@implementation MyViewController

- (void) viewDidLoad {
    [super viewDidLoad];
    ...
    iScrollViewTop = [[MyView alloc] init];
    [self.view addSubview:iScrollViewTop];
    ...
}

@end

When I filled the internal scroll view with images and ran my application it looked OK. But there was some strange behavior. First, scroll did not have bounces as if I had set

iScrollView.bounces = NO;

and second, when I swiped to scroll, after the scroll stopped, the scroll bar did not disappear within one second. 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.

So here are my questions:

  1. Do you know why I am seeing this behavior?
  2. How can I get “usual” behavior for scroll encapsulated by UIView?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:59:45+00:00Added an answer on May 21, 2026 at 4:59 pm

    ok, hacky code follows, so ignore all my other issues, but follow this pattern (westie.jpg = image that was 360×200)

    @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 = @"Hello World";
    l.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)]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question may seem a little bit stackoverflow-implementation specific, but I have seen a
I have little bit longer question for you - but hope answer will be
This is a little bit of a strange question, but I have a bunch
I know my Question is little bit basic but have to ask about this:
I have an application that captures keystrokes. But i have read a little bit
I feel a little stupid asking this question, but I hope that this might
I've a question about Silverlight: I tested a little bit Flex before, but I
I have a little bit seen the representation of an array in memory with
I have a little bit of Javascript that almost works correctly. Here's the code:
So I have a little bit of a problem. I working on a project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.