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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:02:50+00:00 2026-06-06T10:02:50+00:00

I have a button in one of my classes that i create it with

  • 0

I have a button in one of my classes that i create it with xcode/interface builder and I want to connect my button to another class that it create an event based calendar,

I want to press my button but after that it will automatically create another page and inside of that page there is another button –> that when I push that button I can access to the event based calendar page,my question is

how can I remove the second page

here is code that generate second and third pages

AddEvent.h

#import <UIKit/UIKit.h>
#import <EventKit/EventKit.h>
#import <EventKitUI/EventKitUI.h>


@interface AddEvent : UIViewController <UINavigationBarDelegate, UITableViewDelegate, 
EKEventEditViewDelegate, UINavigationControllerDelegate, UIActionSheetDelegate> {

EKEventViewController *detailViewController;
EKEventStore *eventStore;
EKCalendar *defaultCalendar;
NSMutableArray *eventsList;
}

@property (nonatomic, retain) EKEventStore *eventStore;
@property (nonatomic, retain) EKCalendar *defaultCalendar;
@property (nonatomic, retain) NSMutableArray *eventsList;
@property (nonatomic, retain) EKEventViewController *detailViewController;

- (NSArray *) fetchEventsForToday;



@end

AddEvent.m

#import "AddEvent.h"

 @interface AddEvent ()

@end

@implementation AddEvent

@synthesize eventsList, eventStore, defaultCalendar, detailViewController;



  #pragma mark -
  #pragma mark View lifecycle

 - (void)viewDidLoad {

Here is the code that create the second screen

self.title = @"Events List";

// Initialize an event store object with the init method. Initilize the array for events.
self.eventStore = [[EKEventStore alloc] init];

self.eventsList = [[NSMutableArray alloc] initWithArray:0];

// Get the default calendar from store.
self.defaultCalendar = [self.eventStore defaultCalendarForNewEvents];

//  Create an Add button 
UIBarButtonItem *addButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
                              UIBarButtonSystemItemAdd target:self action:@selector(addEvent:)];
 self.navigationItem.rightBarButtonItem = addButtonItem;



self.navigationController.delegate = self;

  // Fetch today's event on selected calendar and put them into the eventsList array
  [self.eventsList addObjectsFromArray:[self fetchEventsForToday]];


  }



 // Allow event editing.
 detailViewController.allowsEditing = YES;

 // Push detailViewController onto the navigation controller stack
 // If the underlying event gets deleted, detailViewController will remove itself from
//  the stack and clear its event property.
  [self.navigationController pushViewController:detailViewController animated:YES];

  }


  #pragma mark -
  #pragma mark Add a new event

  // If event is nil, a new event is created and added to the specified event store. New events are 
  // added to the default calendar. An exception is raised if set to an event that is not in the 
  // specified event store.


  - (void)addEvent:(id)sender {
  // When add button is pushed, create an EKEventEditViewController to display the event.
  EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil];

  // set the addController's event store to the current event store.
  addController.eventStore = self.eventStore;

  // present EventsAddViewController as a modal view controller
  [self presentModalViewController:addController animated:YES];

  addController.editViewDelegate = self;

   }

and also I don’t know how should I connect my button in first screen to the third page and remove the second screen

Thanks in advance!

  • 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-06T10:02:51+00:00Added an answer on June 6, 2026 at 10:02 am

    In your first viewcontrollers’s viewDidLoad add the following UIBarButtonItem code for plus button

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

    self.navigationItem.rightBarButtonItem = addButtonItem;

    and also add the action code

    - (void)addEvent:(id)sender 
    {
    // When add button is pushed, create an EKEventEditViewController to display the event.
    EKEventEditViewController *addController = [[EKEventEditViewController alloc]initWithNibName:nil bundle:nil];         
    // set the addController's event store to the current event store.
    addController.eventStore = self.eventStore;
    
    // present EventsAddViewController as a modal view controller
    [self presentModalViewController:addController animated:YES];
    
    addController.editViewDelegate = self;
    
    }
    

    then add necessary code for adding events in EKEventEditViewController’s viewDidLoad.

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

Sidebar

Related Questions

I have 25 textboxes. I have one button that will paste information in a
I have crated a class which extends the ListFragment . I have one button
I have this code that has one button that let's me choose an entry
i have faced some problem while navigating from one class to another with the
My application is viewbased application in which I have one button. On click of
I'm adding HTML controls dynamically using java script. For instance, I have one button
I have one issue with Datetime Picker In my firstview i have button.If i
I have one issue with UInavigationcontroller In my firstview i have button.If i click
I need to have only one button in showConfirmDialog . I tried this: int
I have one form with several text fields and one button. When i enter

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.