이 Tapku의 방법이며 나는 컨트롤러objective-c에서 다른 클래스의 함수에서 반환 값을 얻는 방법은 무엇입니까?
- (NSDate*) dateSelected{
if(selectedDay < 1 || selectedPortion != 1) return nil;
TKDateInformation info = [monthDate dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
info.hour = 0;
info.minute = 0;
info.second = 0;
info.day = selectedDay;
NSDate *d = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
return d;
}
에서 호출 할 그리고 다음과 같이 호출 및 문자열 형식으로 변환하기 위해 노력하고있어.
TKCalendarMonthView *tk=[[TKCalendarMonthView alloc] init];
NSDate *date=tk.dateSelected;// How can I call it?With the debug it shows it's null.
NSDateFormatter *selectedDate=[[NSDateFormatter alloc] init];
[selectedDate setDateFormat:@"yyyy-MM-dd"];
NSMutableString *stringDate=[NSMutableString stringWithFormat:@"%@",[selectedDate stringFromDate: date]]`
NSDate * date = [tk dateSelected]; – codeplasma
이것은 Xcode와 관련이 없습니다. –
생성 한'TKCalendarMonthView' 객체에서'selectedDay'와'selectedPortion'에 값을 할당해야합니다. 또는 함수에 값을 전달할 수 있습니다. –