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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:22:09+00:00 2026-05-29T05:22:09+00:00

I created a custom calendar for my calendar app … but I have some

  • 0

I created a custom calendar for my calendar app … but I have some problem which I would be grateful if you help me to do this , this code shows a single day .
for example day 2 , 4 , 13 , 24

- (NSString *) showPersianDay {

    NSCalendar *persCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSPersianCalendar];    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSLocale *IRLocal = [[NSLocale alloc] initWithLocaleIdentifier:@"fa_IR"];
    [dateFormatter setLocale:IRLocal];
    [dateFormatter setCalendar:persCalendar];

    offsetComponents = [[NSDateComponents alloc] init];
    offsetComponents.day = _dayNumber;

    NSDate *nextDate = [persCalendar dateByAddingComponents:offsetComponents toDate:[NSDate date] options:0];

    [dateFormatter setDateFormat:@"d"];
    NSString *currDay = [dateFormatter stringFromDate:nextDate];

    [NSString stringWithFormat:@"%@",currDay];

    [persCalendar release];
    [dateFormatter release];

    return currDay;
}

I created a custom table for a month which shows days of a month , so when user tap on this number my date should change according to the numbers ,

enter image description here

for example today is 4 Jan — when user tap 6 Jan my date should change to the 6 Jan.

I don’t have to use some way like : day.text = @"6" or something …. I need return a real DATE, How can I modify my code to show specific day ?
thank you.

  • 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-29T05:22:09+00:00Added an answer on May 29, 2026 at 5:22 am

    Maybe you should have the class return an NSDictionary with multiple keys. One key can contain the string value for the day number, the other can contain the date object.

    - (NSDictionary *) showPersianDay {
    
        NSCalendar *persCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSPersianCalendar];    
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        NSLocale *IRLocal = [[NSLocale alloc] initWithLocaleIdentifier:@"fa_IR"];
        [dateFormatter setLocale:IRLocal];
        [dateFormatter setCalendar:persCalendar];
    
        offsetComponents = [[NSDateComponents alloc] init];
        offsetComponents.day = _dayNumber;
    
        NSDate *nextDate = [persCalendar dateByAddingComponents:offsetComponents toDate:[NSDate date] options:0];
    
        [dateFormatter setDateFormat:@"d"];
        NSString *currDay = [dateFormatter stringFromDate:nextDate];
    
        [NSString stringWithFormat:@"%@",currDay];
        NSDictionary *results = [NSDictionary dictionaryWithObjectsAndKeys:currDay,@"dateString",nextDate,@"DateObj" nil];
    
        return results;
    }
    

    Then on the other side you can display the dateString and cache the DateObj in the calendar cell. Hopefully this solves your question.

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

Sidebar

Related Questions

hi i would like to create a custom calendar, this calendar will have custom
I have created custom cell in which there are n number of image views.
friends, i have created custom title bar using following titlebar.xml file with code <?xml
I am editing a custom calendar application in flash. The purpose of this app
I have created a custom facelets component and I need to set some value
I have implemented drag-n-drop in a custom Calendar view in my application, which does
I created a Custom Day Render and I would like to access some custom
I have a custom list definition created via visual studio 2010. I would like
I have a custom data-bind like this : ko.bindingHandlers.calendar = { init: function(element, valueAccessor)
I created custom adapter for listview which contain text and images, on click of

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.