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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:54:31+00:00 2026-06-15T12:54:31+00:00

I need to create a number of UIScrollViews dynamically and fill them with content.

  • 0

I need to create a number of UIScrollViews dynamically and fill them with content. This is all good except when i set the delegate to self and pan the list i get this exception:

Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSCFString scrollViewDidScroll:]: unrecognized selector sent to instance 0x7581230’

NSCFString obviously isn’t my view controller (which implements the protocol UIScrollViewDelegate) so from what i gather somehow the memory gets messed up and it doesn’t keep the reference correctly. Occasionally this can be something else too which strongly points to something being wrong with the memory

Here’s the code to create the list:

for (NSUInteger i = 0; i < self.stories.currentStory.selectableWordCount; i++) {
    UIScrollView *list = [[UIScrollView alloc] init];
    list.alwaysBounceVertical = YES;
    list.showsVerticalScrollIndicator = NO;
    list.clipsToBounds = NO;
    list.delegate = self;
    list.pagingEnabled = YES;
    [self.view addSubview:list];

    .. // add UILabels to the list, set the frame, contentSize etc

    [self.wordLists addObject:list]; // this is a @property (nonatomic, strong) NSMutableArray, declared in a private interface()
}

If i NSLog the delegate it’s correct. respondsToSelector also matches fine. Interestingly if i comment out the scrollViewDidScroll: respondsToSelector: doesn’t match any more and (probably because of this) the UIScrollView won’t attempt to call this method any more. This then means that it can reach the delegate correctly to check for the method availability but when it gets called something goes wrong.

I’m targeting iOS5 with ARC. If this wasn’t the case i would assume that i messed something up with the memory myself but now i don’t have the same control.

I’m having a hard time debugging this issue, any help on how to proceed would be appreciated

  • 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-06-15T12:54:32+00:00Added an answer on June 15, 2026 at 12:54 pm

    D’uh. I was obviously looking in the wrong place. The view controller was added through a .xib and the view was pointing to a subview on the stage. However i needed to create an IBOutlet to the view controller in the main view controller to make sure it stays in memory. Hopefully this can help somebody else with a similar problem 🙂

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

Sidebar

Related Questions

I need to create a structure that holds a variable number of 'char[2]'s, i.e.
I need to create hot-keys for every control + number combination and would prefer
I need to create input fields on the basis of which number was chosen
I need to create a function which rounds decimal numbers like this: Round($32.95, 0)
I need to create a random number of dropdownlists in my view, based on
I need to create an unknown number of python variables, based on a list
In a Django application I need to create an order number which looks like:
I need to create a temp table who contains the number of employes of
I need to create a tree, constructed of nodes that may have any number
I need to create 3d depth effect for my image. Number 1 is what

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.