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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:20:13+00:00 2026-05-24T08:20:13+00:00

In my application i have a nib file (view A) containing some textFields. In

  • 0

In my application i have a nib file (view A) containing some textFields. In front of date textField i have put button pressing which takes to the calendar view. I used the code

-(IBAction)cal:(id)sender
{
    CalendarTestViewController *calander1=[[CalendarTestViewController alloc]initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:calander1 animated:NO ];
    [calander1 release];
}

That is fine.It takes me to calendar view and in calendar view i have wrote the code so that when somebody tap a date it will automatically move to previous view i.e. view A. Then when somebody press a button in A , which takes you confirmation view(another class).It flush all data in textFields.

I was wondering rather then using

[self.navigationController pushViewController:calander1 animated:NO ];

is there any other way to accomplish this behaviour. i want to save my data for confirmation view.

This is my calendar View tap tile method.

- (void)calendarView:(KLCalendarView *)calendarView tappedTile:(KLTile *)aTile
{
    // NSLog(@"Date Selected is %@",[aTile date]);

    if (cat==nil) {
        cat=[[FormController alloc]initWithNibName:nil bundle:nil];
        NSString *st=[[NSString alloc] initWithFormat:@"%@",[aTile date]];
        cat.mas=st;

        [self.navigationController pushViewController:cat animated:YES];
        [cat release];

        [self dismissModalViewControllerAnimated:YES];

}
} 

after pressing any time from calendar i want to fill date on textField n return to the previous view
I dont want to put this calendar view in navigation stack.


After some changes : below is my CalendarTestViewController.m file’s tap tile method.

- (void)calendarView:(KLCalendarView *)calendarView tappedTile:(KLTile *)aTile
{
    // NSLog(@"Date Selected is %@",[aTile date]);

    if (cat==nil) {
        cat=[[FormController alloc]initWithNibName:nil bundle:nil];
        NSString *st=[[NSString alloc] initWithFormat:@"%@",[aTile date]];
        cat.mas=st;

        //[self.navigationController pushViewController:cat animated:YES];
        //[cat release];

        [self dismissModalViewControllerAnimated:YES];
}
}

FormController.m

- (void)calendarDidSelectDate:(NSDate *)selectedDate
{
    cali.text=mas;
    // set the selectedDate wherever it needs to be...
}


-(IBAction)cal:(id)sender
{
    CalendarTestViewController *calendar1=[[CalendarTestViewController alloc]initWithNibName:nil bundle:nil];

    calendar1.delegate = self;

    [self.navigationController presentModalViewController:calendar1 animated:YES];

}

I have done exactily the same as suggested means protocols and delegate defined same way. no error shown but date is not selected and not filled in label.text in formController

  • 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-24T08:20:14+00:00Added an answer on May 24, 2026 at 8:20 am
    [self.navigationController presentModalViewController:calander1 animated:YES];
    

    This will bring your calendar view from bottom by default. If you want it to cross-fade you can set:

    calendar1.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    

    or you can have it flip by setting:

    calendar1.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    

    You need to call this setter before presenting the view controller btw. Also, presenting this calendar view controller modally means you have to dismiss it modally instead of popping it from navigationController.

    [self dismissModalViewControllerAnimated:YES];
    

    Edit

    To give the selected date back to your FormController, you need to declare a delegate protocol inside your CalendarTestViewController.h

    @protocol CalendarTestViewControllerDelegate
    
    - (void)calendarDidSelectDate:(NSDate *)selectedDate;
    
    @end
    

    This tells your compiler that the delegate will have to implement method named calendarDidSelectDate:

    Then you need to give your CalendarTestViewController a delegate property, also inside .h, right before the last @end

    @property (nonatomic, assign) id<CalendarTestViewControllerDelegate> delegate;
    

    This means you have a property of any class (that’s what id stands for) that conforms to CalendarTestViewControllerDelegate protocol you declared above, and that property is called delegate. In your CalendarTestViewController.m file right under @impelementation line you have to put:

    @synthetize delegate;
    

    And now in your FormController.h at the line that says @interface FormController : UITableViewController you need to add <CalendarTestViewControllerDelegate> which tells the compiler this class will conform to that protocol. Now all that’s left to do is in your -(IBAction)cal:(id)sender method add calendar1.delegate = self; and implement the delegate method somewhere inside FormController.m

    - (void)calendarDidSelectDate:(NSDate *)selectedDate
    {
        // set the selectedDate wherever it needs to be...
    }
    

    Edit2

    You need to replace:

    - (void)calendarView:(KLCalendarView *)calendarView tappedTile:(KLTile *)aTile{
    // NSLog(@"Date Selected is %@",[aTile date]);
    
    if (cat==nil) {
        cat=[[FormController alloc]initWithNibName:nil bundle:nil];
          NSString *st=[[NSString alloc] initWithFormat:@"%@",[aTile date]];
        cat.mas=st;
    
      //  [self.navigationController pushViewController:cat animated:YES];
        //[cat release];
    
        [self dismissModalViewControllerAnimated:YES];
    
    }
    

    with something like:

    - (void)calendarView:(KLCalendarView *)calendarView tappedTile:(KLTile *)aTile
    {
        [self.delegate calendarDidSelectDate:[aTile date]];
        [self dismissModalViewControllerAnimated:YES];
    }
    

    and:

    - (void)calendarDidSelectDate:(NSDate *)selectedDate
    {
        cali.text=mas;
        // set the selectedDate wherever it needs to be...
    }
    

    with:

    - (void)calendarDidSelectDate:(NSDate *)selectedDate
    {
        cali.text = [NSString stringWithFormat:@"%@", selectedDate];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multiple Nib application, and in my awakeFromNib: method, some IBOutlet s
In my application I have a single nib file. The File's Owner is a
I have a UIViewController subclass whose view is configured in a NIB file. The
I see an application have used Log.info = some info where are these logs
In my console application have an abstract Factory class Listener which contains code for
I have application which needs to use a dll (also written by me) which
The setting is the following: I have a cocoa object in a nib file
Greetings, I have a view based application project where I have created an NSObject
I have an iOS application for which I want to create a ViewController programmatically.
I have renamed some nib files, from EEMSystemDetailElpho to EEMSystemDetailElphoView, EEMSystemDetailTransfer to EEMSystemDetailTransferView, EEMSystemDetailProbing

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.