You can get the 1-based index of the first weekday of the current locale from the -firstWeekday
method of an NSCalendar
object with the current locale. Then you can modify your week names array accordingly:
// get week day names array
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
NSArray *weekdays = [dateFormatter shortWeekdaySymbols];
// adjust array depending on which weekday should be first
NSUInteger firstWeekdayIndex = [[NSCalendar currentCalendar] firstWeekday] - 1;
if (firstWeekdayIndex > 0)
{
weekdays = [[weekdays subarrayWithRange:NSMakeRange(firstWeekdayIndex, 7-firstWeekdayIndex)]
arrayByAddingObjectsFromArray:[weekdays subarrayWithRange:NSMakeRange(0,firstWeekdayIndex)]];
}
I don't have the iPhone SDK but AFAIK these APIs should be all available there and behave the same way as on OS X.