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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:28:36+00:00 2026-05-20T20:28:36+00:00

There is one issue that I’ve been struggling with and I can’t seem to

  • 0

There is one issue that I’ve been struggling with and I can’t seem to get enough information about it on the web. It has to do with the Apple multitasking and the Tab bar view. I want to control which tab will be selected when the application is entering foreground or becoming active.
At the moment every time I will close the app and re-open it, it will open the last UIView that was displaying on the tab bar. How can I control that?

Firstly, I want to be able to display a preview image with the app logo every time the application becomes active. Here is the code I’m using for that but I keep getting EXC_BAD_ACCESS when the app is entering foreground for this line: [window addSubview:self.preMiniView]:

   - (void)applicationDidBecomeActive:(UIApplication *)application {
    if (!self.preMiniView)
    {
        self.preMiniView = [[UIImageView alloc] initWithFrame:window.frame];    
        self.preMiniView.frame = CGRectMake(0,0,324,480);
        window.backgroundColor = [UIColor colorWithRed:21.0/255.0 green:7.0/255.0 blue:2.0/255.0 alpha:1];  
    }       
    UIImage *img = [UIImage imageNamed:@"preloadSm.jpg"];
    self.preMiniView.image = img;
    [img release];

    if (self.preMiniView.alpha == 0.0)
    {
        [self.preMiniView setAlpha:1.0];
    }

    [window addSubview:self.preMiniView];  // adding the how to view to the view.

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(initApp:)
                                   userInfo:nil
                                    repeats:NO];
    }



      - (void)applicationDidEnterBackground:(UIApplication *)application 
       {
          [tabBarController.view endEditing:YES];

        [tabBarController.view setAlpha:0.0];
        [self.preMiniView release];
        self.preMiniView = nil;
        NSLog(@"applicationDidEnterBackground iphone"); 
    }

    - (void)initApp:(NSTimer *)timer
    {
        if (self.preMiniView)
        {
            [NSTimer scheduledTimerWithTimeInterval:0.5
                                             target:self     
                                           selector:@selector(removePrev:)
                                           userInfo:nil
                                            repeats:NO];
            [window insertSubview:tabBarController.view atIndex:0];
            [tabBarController.view setAlpha:1.0];
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:.7];
            [self.preMiniView setAlpha:0.0];
            [UIView commitAnimations]; 
          }
    }
    - (void)removePrev:(NSTimer *)timer
    {
        [self.preMiniView removeFromSuperview];
    }

Secondly, I’m trying to present a pdf file with one of my UIViews when my app is hitting the method application:openURL:sourceApplication:annotation (used for opening a file from the email app). I get the correct file url but I’m not sure how to display the actual file in one of my custom UIView called PDFReaderViewController. It seems I can’t just use this code on the AppDelegate:

pdfController = [[PDFReaderViewController alloc] init];
[pdfController initFromName:fileName];

[[self navigationController] pushViewController:pdfController animated:YES];
[pdfController release];
pdfController = nil;

I get a warning: receiver ‘PDFReaderViewController’ is a forward class and corresponding @interface may not exist

Any idea how to display the new file using PDFReaderViewController from the AppDelegate?

I must be missing something basic here …. thanks for your help!

  • 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-20T20:28:36+00:00Added an answer on May 20, 2026 at 8:28 pm

    I want to point out that you are not properly following some memory management rules. The dot notation means you are accessing a property and that should be taking care of memory management for you and may be the reason for you EXC_BAD_ACCESS.

    //You need to autorelease  the image view here
    self.preMiniView = [[UIImageView alloc] initWithFrame:window.frame];
    ...
    //Never release a property directly
    [self.preMiniView release];
    //This is the correct way to release the property
    self.preMiniView = nil;
    
    ...
    
    //This creates autoreleased image
    UIImage *img = [UIImage imageNamed:@"preloadSm.jpg"];
    //This will increment retain count
    self.preMiniView.image = img;
    //This is reason for EXC_BAD_ACCESS do not release you never retained it yourself
    [img release];
    

    The warning about a forward class reference means some where in a header file you probably have some code like @class PDFReaderViewController; and never include the the correct header in the implementation class.

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

Sidebar

Related Questions

A 3rd party web application has a cross-scripting security issue. There is one page
we are migrating from WebLogic web-services to Spring-WS (1.5.X). There is currently one issue
Is there one method or property in the .NET Framework that tells if an
There's one specific feature that I wish was in the .NET framework, but isn't.
There is one form, inside the form there are many checkboxes. Two operations can
i have a streamreader which loads up a csvfile, the issue is that there
Im trying to stupid the ways of building a game. One issue that i
I have the pagination module working for the most part but there's one issue.
I want to build my solution file using MSBuild but there is one issue.
I'm looking for a standard dual-map structure - is there one implemented in std/boost/another

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.