2011-07-04 5 views
0

평일을 알 수있는 여러 가지 방법을 보았지만 그 중 어느 것도 선택한 날짜에 없었습니다.오늘 날짜가 아닌 요일을 가져옵니다.

NSDate * selectedDate = _selectedDate //From Params 

NSCalendar *cal = [NSCalendar currentCalendar]; 
NSDateComponents *components = [cal components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:[[NSDate alloc] init]]; 

NSInteger weekday = [components weekday]; 

어떻게하면 내가 선택한 날짜를 삽입해야합니까?

[구성 요소 setDay : (INTEGER REQUIRED)] 이 (가) 선택한 날짜를 현재 날짜로 변환하는 방법이기 때문에 누구에게도이 사실에 대한 단서가 있습니까?

감사의

답변

0

Have You try?

NSDateComponents *components = [cal components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:selectedDate]; 
0
NSDateComponents *components = 
[cal components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit 
     fromDate:selectedDate]; 
관련 문제