• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iPhone Creating a months view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iPhone Creating a months view


  • Subject: Re: iPhone Creating a months view
  • From: Wyatt Webb <email@hidden>
  • Date: Mon, 4 Jan 2010 10:59:02 -0800

On Jan 4, 2010, at 10:35 AM, Eric E. Dolecki wrote:

> I am creating an iPhone view that has 12 months of views in it starting with
> January.
>
> For each subview (month) I need to get the 1st day of the month (which
> calendar day it falls on as an int). For instance Jan 2010 begins on a
> Friday (int of 5 I assume).
>
> This way I can properly populate the UILabels I am positioning in each
> subview.
>
> I saw this: http://theocacao.com/document.page/389
>
> but I can't get it to work for the iPhone. I am going through docs and
> google at the moment. Any help appreciated.
>
> Eric

I think the best approach would be a combination of NSDate, NSCalendar, and NSDateComponents.

You could create an NSDate for the first of each month (1/1, 2/1, 3/1, etc.) and then use the components:fromDate: method on NSCalendar with the NSWeekdayCalendarUnit constant to get the day of the week for the first of the month. That comes out as an int from 1 to 7 (1 is Sunday, 7 is Saturday, so Friday would be 6).

Wyatt_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: iPhone Creating a months view
      • From: Alex Kac <email@hidden>
References: 
 >iPhone Creating a months view (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: iPhone Creating a months view
  • Next by Date: Re: iPhone Creating a months view
  • Previous by thread: iPhone Creating a months view
  • Next by thread: Re: iPhone Creating a months view
  • Index(es):
    • Date
    • Thread