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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:35:08+00:00 2026-05-18T05:35:08+00:00

Thanks for all your help, as usual, i am looking for some more information…

  • 0

Thanks for all your help, as usual, i am looking for some more information…

Regarding view controllers, i am trying to develop an application with multiple views.

View Controller loads from View A using presentModalViewController – and loads View B from there – also works fine, but i have some nagging questions…

View A has a table in it, which drills down to View B, and i can move back to view A usig dismissModalViewController, but once back in View A i can’t access the table in View A.

What happens to controls/variables in View A when View B is pushed? is the dealloc called when View B is called? If i wish to access controls/variables when View B is dismissed and View A comes back into view, what do i need to do?

Is there some article that can educate on this?
ANy help is highly appreciated

To re-iterate

  • View Controller initiates a page from View x
  • View X loads – View A with a table into the view using presentModalViewController
  • table is released in View A’s dealloc
  • View B loads fine, works fine – dismissing the view B controllers takes back to View A
  • At this point, i would like to reload the table in View A once it comes back onto the screen

I am pretty sure there are many other fellow members who are in this kind of situation

Here is my code, in bits and pieces

startPage – (This is the application’s home page) with a Start Button, contains

 View Controller -> View

On clicking the start button, am loading a viewcontroller called ViewA(View Controller -> View), with the following code

UIViewController *viewA= [[viewA alloc] initWithNibName:@"viewA" bundle:nil];
viewA.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
[naviControl presentModalViewController:viewA animated:YES];    
[viewA release];   

On picking a table row in ViewA, another viewcontroller ViewB(View Controller -> View) is called with the follwoing code

UIViewController *viewB= [[viewB alloc] initWithNibName:@"viewB" bundle:nil];
viewB=UIModalTransitionStyleCoverVertical;
[self viewB animated:YES];

ViewB is dismissed and VIewA is shown with code

[self dismissModalViewControllerAnimated:YES];

At this point, with some NSLogs, when ViewB is dismissed, only viewWillAppear is called on ViewA, not viewDidLoad and if i try to reload data on the table in ViewA, the app crashses with EXC_BAD_ACCESS

Thanks
Veeru

  • 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-18T05:35:09+00:00Added an answer on May 18, 2026 at 5:35 am

    First of all, please correct following statement:

    UIViewController *viewA= [[viewA alloc] initWithNibName:@"viewA" bundle:nil];
    

    to

    UIViewController *viewA= [[UIViewController alloc] initWithNibName:@"viewA" bundle:nil];
    

    and secondly you will need to understand the memory management and flow of view controllers, e.g.

    1. when you allocate a view controller then an instance with retain count 1 is initiated in the memory,
    2. when you push or present this view controller on to the screen then its retain count becomes 2 as now another instance either navigation controller or view controller is using your instance,
    3. then you release it this makes retain count of your view controller’s instance again to 1, i.e. reduces by 1, (you must be aware that when the retain count becomes 0 then only it will be freed from memory).
    4. then you have called another view controller on top of this current view controller which makes it to go in background and as you haven’t retained the instance explicitly it is getting released by your nav controller or view controller in which you added, so its retain count becomes 0, hence freed from memory.
    5. so when you try to reload tableview it is giving you EXC_BAD_ACCESS as you are trying to use an instance which is already freed.

    Solution:

    1. If you are trying to use multiple navigation screens in your application, you should only use pushViewController method of UINavigationController which keeps the instances of viewcontroller until you explicitly release them.

    2. Also be careful of using local instances or object instances and their retain count, keep track of alloc and release i.e. retain count, it should not be 0 unless you want them.

    Hope this will help…

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

Sidebar

Related Questions

Thanks for your help! I'd like to output all companyName entries that have uploads
UPDATE: Thanks for all your help guys! I just need to take a litte
A bit confusing this one but should make sense. Thanks to all your help
First, thanks for all your help! You really make a difference, and I GREATLY
Thanks at all for all your help for now.I have another little issues This
Thanks for all your help - see blow original question, and my edit following
Thanks for all your help, I now have add, update, and delete functions on
I am a newbie to VBS scripting. Thanks for all your comments! I fixed
first of all thanks for taking your time! I'm a junior Dev, working with
First of all thank you for your time and sorry if some issues are

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.