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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:15:20+00:00 2026-05-27T01:15:20+00:00

I am working on a Tab Bar based application I have a class A

  • 0

I am working on a Tab Bar based application
I have a class A with its .xib and a class B with its .xib

On class A i am loading multiple instances of class B.

i.e In class A ,i am doing.

in .m file

   -(void)renderData:(NSArray *)Data
    {
         for(int i=0;i<[Data count];i++)
            {
               B *grid=[[B alloc]initWithNibName:@"Beta" bundle:[NSBundle mainBundle]];
               .
               .
               . //do something with the grid object i.e assign new image etc..)
               [self.myGrid addObject:grid]; //i have a NSMutableArray myGrid declared in .h
               [grid release];  
            }
    }

now in the myGrid Array i have all the objects of the grid saved.

Now i am adding them to the class Aplha view.

    for(int i=0;i<[myGrid count];i++)
      {
        B *grid1=[[myGrid objectAtIndex:i]retain]; //i have done this retain because when i try to come back to this tab or try to call the same function it crashes by saying message send to deallocated instance.
        [self.view addSubview:grid1.view];
       }

now my problem is that how to release the grid1 object that i have retained.

  • 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-27T01:15:21+00:00Added an answer on May 27, 2026 at 1:15 am

    You are approaching this wrong. The problem here isn’t how to release the grid1 object, it’s why you are retaining them in the first place. You most likely shouldn’t be; you need to investigate the original crash more thoroughly.

    If your grid1 objects are stored in self.myGrid then they are retained by that array. Are you releasing myGrid anywhere? As long as that is retained, your grid1 objects should be.

    In addition, there are some conceptual issues here. Loading a view controller from a nib and adding it’s view as a sub-view of another view controller’s view is generally not correct. It’s hard to recommend the correct approach without knowing exactly what you are trying to achieve though.

    You do not need to pass in [NSBundle mainBundle] to initWithNibName:bundle: – you can simply pass in nil as the default behaviour is to use the main bundle.

    Your comment says you have “assigned” an NSMutableArray in your header. You don’t assign anything in your header, you just declare things. Have you actually initialised the NSMutableArray somewhere in your implementation?

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

Sidebar

Related Questions

I am working on a simple app tab-bar based application that has two views.
I have a tab bar application where everything is working fine. I have rotations
I have developed an iPhone application based on Tab bar & Navigation bar and
I'm working on a tab bar application and one of the tabs has a
I have developed an iPhone application with tab bar and navigation controllers. It is
I have just started working on localization of this application. Starting with three tab
Hai, I have created a tab based iRestaura project. I use 5 tab bar
I have following problem. I have created a tab based Application with three Views
I'm working on an iphone application that has exactly 5 tab bar buttons. I've
I'm programmatically creating a tab bar based app. In the application:didFinishLaunchingWithOptions (app delegate) method

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.