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

  • Home
  • SEARCH
  • 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 8025455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:10:15+00:00 2026-06-04T23:10:15+00:00

using ARC feature record_audio_testViewController *view2 = [[record_audio_testViewController alloc] initWithNibName:@record_audio_testViewController bundle:nil]; [self.view addSubview:view2.view]; using the

  • 0

using ARC feature

record_audio_testViewController *view2 = [[record_audio_testViewController alloc] initWithNibName:@"record_audio_testViewController" bundle:nil];

    [self.view addSubview:view2.view];

using the above code the page is navigate to view2 page but there i am not able access any button.. in view2 i pressed a button i got error

Exe_Bad_Access(code=1 address=012902)

how to release a memory properly????

but using

[self.navigationController pushViewController:view2 animated:YES];

this popviewController and pushViewController not working ..(NOT ABLE TO NAVIGATE VIEW2 PAGE)

anyone know the reason????

  • 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-04T23:10:17+00:00Added an answer on June 4, 2026 at 11:10 pm

    The problem is that you’re creating the view controller, but you’re not using it, but rather only using its view (but letting ARC release the view controller, itself, when it goes out of scope). When transitioning between view controllers, you should use pushViewController (if you’re using a navigation controller) or presentModalViewController (if you want to present the next view modally; in iOS 5 use presentViewController). In the unlikely event you are using a container view controller, you could even use transitionFromViewController to transition between child view controllers. See View Controller Programming Guide for guidance on how to transition between view controllers. But in WWDC 2011 session 102, Apple clearly advises that you want to ensure that your hierarchy of view controllers be properly structured (generally mirroring your view hierarchy); you shouldn’t be just adding views and ignore the view controller hierarchy.

    Anyway, the standard technique for transitioning between views is to use a navigation controller (that’s what gives you the title bar with the “back” button … you can hide it if you don’t want it visible):

    record_audio_testViewController *view2 = [[record_audio_testViewController alloc] initWithNibName:@"record_audio_testViewController" bundle:nil];
    
    [self.navigationController pushViewController:view2 animated:YES];
    
    // if non-ARC project, uncomment the following line
    // [view2 release];
    

    Finally, if you really want to use your technique of adding the view of your new controller as a subview of your current view controller’s view (which doesn’t seem like a good idea), you just want to make sure that ARC doesn’t release it when it goes out of scope. So, don’t let it go out of scope by making the new view controller an ivar of your current view controller, not a local var of your current method. That solves the ARC issue, but doesn’t seem like a good technique, as you probably should be doing a proper transition between view controllers, but I present it in the interest of full disclosure.

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

Sidebar

Related Questions

I'm new to git. I want to use this code: https://github.com/TouchCode/TouchJSON/tree/feature/ARC But, when I
Using ARC... NSArray *array = [NSArray arrayWithObjects:@dog, @cat, @mouse, nil]; for(NSString *animal in array)
I'm working with some example code that draws an arc using CGPaths. I've had
Using ARC, is it now OK to assign a string value like this: self.userName
I created an app using the iOS 5 Storyboard feature, and have decided I
My project using ARC, so I can't use retain nor release, in ViewController A,
I'm developing an iOS5 App using ARC, and I started to get some random
I'm developing a large scale application for iOS 5 using ARC in xcode. The
What is the lowest iOS version I can build for while using (ARC)? I'm
I'm trying to use TPMultiLayoutViewController in a project using ARC, but am bumping into

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.