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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:12:23+00:00 2026-06-15T08:12:23+00:00

i am creating a toolbar application, in that application all toolbar icons and actions

  • 0

i am creating a toolbar application, in that application all toolbar icons and actions done successfully.But when i used the icon for next view calling and from that view i am calling a back button then it will crashed..here i am adding my code

/////In View Did load

    objectLabel = [[UILabel alloc]init];
   objectLabel.frame = CGRectMake(10, 10, 300, 40);
   objectLabel.text = @"Press Button";
   [self.view addSubview:objectLabel];
   NSLog(@"label");
   objectToolbar=[UIToolbar new];
    objectToolbar.barStyle = UIBarStyleBlackTranslucent;
   [objectToolbar sizeToFit];
   objectToolbar.frame = CGRectMake(0, 410, 320, 50);
   NSLog(@"toolbar");

   UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
                                                                             target:self
                                                                             action:@selector(pressButton1:)];

   UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                                             target:self
                                                                             action:@selector(pressButton2:)];

   UIBarButtonItem *systemItem3 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera
                                                                             target:self
                                                                             action:@selector(pressButton3:)];
   UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
                                                                          target:nil
                                                                          action:nil];
   NSArray *items = [NSArray arrayWithObjects: systemItem1, flexItem, systemItem2, flexItem, systemItem3, nil];
   [objectToolbar setItems:items animated:NO];
   [self.view addSubview:objectToolbar];

///after that

 -(void) pressButton1:(id)sender{
   // objectLabel.text = @"Add";
       FirstViewController *objectFirstViewController=[[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
       [self.view addSubview:objectFirstViewController.view];

   }

 -(void) pressButton2:(id)sender{
objectLabel.text = @"Take Action";
 }  

-(void) pressButton3:(id)sender{
objectLabel.text = @"Camera";
}

///in FirstViewController.m

   -(IBAction)back:(id)sender
    {
      ViewController *objectViewController=[[ViewController  alloc]initWithNibName:@"ViewController" bundle:nil];
      [self.view addSubview:objectViewController.view];
   }

When i clicked the back button it will crashed..please give me the solution

  • 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-15T08:12:24+00:00Added an answer on June 15, 2026 at 8:12 am

    just remove from superview of the current view for ex..

       [self.view removeFromSuperview]; 
    
     // or  if you want to call the method from your MainViewController use this line [objectFirstViewController removeFromSuperview];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a toolbar that toggles the visibility of buttons when you click a
I'm creating a plugin project that will have a menu and toolbar item, that
I am building an application which has requirements stating that all browser features must
I'm currently creating an ipad application. the idea is to have a toolbar at
I am new to iphone development.I am creating a map application.I have toolbar below
I am creating a toolbar on Windows that is being ported over to the
I created a simple class to hide the details of creating a toolbar in
I am creating a simple toolbar using RelativeLayout and to a button image i
How do I go about creating my own taskbar toolbar, a la Windows Media
Creating a class at runtime is done as follows: klass = Class.new superclass, &block

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.