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 3623348
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:22:20+00:00 2026-05-18T23:22:20+00:00

Hello I have a problem with UIScrollView and I hope someone can help me.

  • 0

Hello I have a problem with UIScrollView and I hope someone can help me.

I have a UIView with 700×580 pixel in the center of that view I add a UIScrollview with 350×580 pixel. In this scrollView I add 10 subViews next to each other then I set the property clipsToBounds on the scrollview to NO that I can see the subViews of the scrollView witch was not in the scrollView. Now my problem the subviews of the scrollView was also show at the outside of the UIView. Is there any why to disable that?

Here is a sample code of my problem

UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 700, 580)];
CGFloat viewDisdance = 50;
UIScrollView *theScrollView = [[UIScrollView alloc] 
                               initWithFrame:CGRectMake((myView.frame.size.width-350)/2, // X
                                                        0,                               // Y
                                                        350+viewDisdance,                // with
                                                        580)];                           // height

theScrollView.backgroundColor = [UIColor blueColor];
theScrollView.clipsToBounds = NO;
theScrollView.pagingEnabled = YES;
[myView addSubview:theScrollView];

CGFloat offset = 0.0;
for (NSInteger i = 0; i<10; i++) {
    UIView *aSubView = [[UIView alloc] initWithFrame:CGRectMake(offset, 0, 350, 580)];
    aSubView.backgroundColor = [self randomColor];   //a method that givs me a random color back
    offset += aSubView.frame.size.width;
    offset += viewDisdance;
    [theScrollView addSubview:aSubView];
}

[window addSubview:myView];

Here is a screen from the result of this code sample

Image
http://img18.imageshack.us/i/bildschirmfoto20110104u.png/

the red area is myView

the blue area is theScrollView

and the other color areas are the subViews of theScrollView

  • 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-18T23:22:21+00:00Added an answer on May 18, 2026 at 11:22 pm

    Can you try myView.clipsToBounds = YES;?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i have new Problem with Add Form my problem here WARNING: /test.xhtml @24,173
hello i have a problem i am trying to convert a string like 12314234
Hello I have a bizarre problem with sprintf . Here's my code: void draw_number(int
Hello i have just started learning mvc2 and im having a problem with the
I have a problem with the MASM32 assembler The following code is a Hello
Hello everyone and thanks in advance. I have a problem and I have 2
Hello I have a pump class that requires using a member variable that is
I have strange problem with the delay function here using the HTML function with
I have a problem with Nvidia's OpenCl/Cuda framework, but I think it is a
Hello I have two dependants select box, the second one is popularited after onchange

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.