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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:22:54+00:00 2026-06-06T15:22:54+00:00

I am have an issue with my scrollview which holds multiple views. I think

  • 0

I am have an issue with my scrollview which holds multiple views. I think the problem is that subviews are being released. I have buttons in the subviews and when I click the buttons I get this error, [GraphDisplayViewController performSelector:withObject:withObject:]:

message sent to deallocated instance

. If there is only one subview then I can just use a property and this works, but since the number of subviews varies(one or more), it does not work and I don’t know how to solve this.

I currently load all the views at once in the beginning. I’m working on only loading one subview at a time and assigning the property to that view, but I’m not sure if that will work.

My layout is as follows, a parent view(DetailViewController) contains a scrollview, I add views(GraphDisplayViewController) to the scrollview, the subviews each load a view(GraphView).

Any help or advice would be greatly appreciated. If you need any more details please let me know. Thank you for your time.

Code sample of how I add the subviews,

DetailViewController

- (void)loadScrollViewWithPage:(int)page
{
if (page < 0) return;
if (page >= pageControl.numberOfPages) return;

subView = [viewControllers objectAtIndex:page];   
NSString *description;
NSString *packsize;
if ((NSNull *)subView == [NSNull null]) 
{
    subView = [[GraphDisplayViewController alloc] initWithNibName:@"GraphDisplayViewController" bundle:nil];
    [viewControllers replaceObjectAtIndex:page withObject:subView];
    subView = [[GraphDisplayViewController alloc] init];
    subView.molecule = moleculeName;
    subView.description = description;    
    subView.dataArray = moleculePrices;

}
else
{
    return;
}

// add the controller's view to the scroll view
if (nil == subView.view.superview) 
{
    CGRect frame = scrollView.frame;
    frame.origin.x = frame.size.width * page;
    frame.origin.y = 0;
    subView.view.frame = frame;
    [scrollView addSubview:subView.view];
} 
}

UPDATE
There was a mistake in the code, testing to see if that solves anything

subView = [[GraphDisplayViewController alloc] initWithNibName:@"GraphDisplayViewController" bundle:nil];
[viewControllers replaceObjectAtIndex:page withObject:subView];
subView = [[GraphDisplayViewController alloc] init]; <- Mistake
  • 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-06T15:22:56+00:00Added an answer on June 6, 2026 at 3:22 pm

    There was a simple error in my code, I init the view twice.

    subView = [[GraphDisplayViewController alloc] initWithNibName:@"GraphDisplayViewController" bundle:nil];
    subView = [[GraphDisplayViewController alloc] init]; <- Mistake
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have view which contains a scrollView. When the view shows up the image
I am having the issue with scrollview . I have added the scrollview with
I have 2 scrollviews, super scrollview includes multiple scrollviews inside. Super scrollview will make
HI! I have a surfaceView inside a horizontal scrollview that I want to fill
i have a UIWebView on a modal view. The problem is that when the
I have a MkMapView on which I have some Annotations. When I click an
I have a UIViewController . Within that is a UITableView which is drawn at
I have a Scrollview as a parent view, within that i have placed some
In Android, I have a Parent RelativeLayout . Inside that I have, a ScrollView

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.