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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:41:13+00:00 2026-06-17T18:41:13+00:00

I am trying to call a new view inside my existing view TransactionFinish *childView=

  • 0

I am trying to call a new view inside my existing view

TransactionFinish *childView= [[TransactionFinish alloc] initWithNibName:@"TransactionFinish" bundle:nil];

        childView.view.frame = self.view.frame;

        childView.view.frame=CGRectMake(10, 10, self.view.frame.size.width-20, self.view.frame.size.height-20);
        childView.view.alpha = 0.0f;
        [self.view addSubview:childView.view];

        [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationCurveEaseOut
                         animations:^{
                             childView.view.alpha = 1.0f;
                         }
                         completion:^(BOOL finished) {
                         }];

It is going inside ViewDidLoad() of TransactionFinish(I have tried debugging it) but it gives me Thread EXEC_BAD_ACCESS(code=1,address=0x31f54e62) with green color

  • 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-17T18:41:14+00:00Added an answer on June 17, 2026 at 6:41 pm

    The issue lays with the lifetime of childView. You instantiate and store a reference to it into a local variable:

    TransactionFinish *childView= [[TransactionFinish alloc] initWithNibName:@"TransactionFinish" bundle:nil];
    

    If you are using ARC, when the local variable goes out of scope, the object referenced by it (childView) is deallocated.

    If you are not using ARC, I suppose you are doing:

    [childView release];
    

    somewhere to avoid childView to be leaked (as the code you pasted above would imply).

    Either hypothesis would explain why you get the crash: when viewDidLoad is called, the controller has already been deallocated.

    Adding childView view to self.view:

        [self.view addSubview:childView.view];
    

    will retain childView.view but not childView. So the controller is deallocated, while its view is not.

    A fix to this is creating a strong property in your class to store a reference to your childView controller:

    @property(nonatomic, strong) TransactionFinish *childView;
    

    Another possibility is using controller containment; you could do something li

    [vc willMoveToParentViewController:self];
    [self addChildViewController:childView];
    [self.view addSubview:childView.view]; // or something like this.
    [childView didMoveToParentViewController:self];
    

    but this will only work on iOS5+.

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

Sidebar

Related Questions

Hello I'm essentially trying to do this inside a new view window in SQL
Here is the code im trying to call inside onCreate() _t = new TheThread(this);
I'm trying to use require_once to call Mail.php but when I create a new
I have the following partial view that I am trying to get to call
I am trying to find a way to call a MessageBox from inside a
I was trying to call new alert dialog when a new quick action triggers.
I'm trying to call a view helper from a custom RedCloth tag and am
I'm trying to initialize the values inside a view (created inside a nib file)
I can create new managed objects inside my app, in a separate view I
I am trying to add a canvas view to a relative layout inside a

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.