카테고리 Archives: 미분류

GPS 작업 11

1. 시계의 추가

.h

    NSCalendar*         calendar;

    NSDateComponents*   comps;

추가

.m

초기화 부분

       //날짜 정보 초기화

        calendar= nil;

        comps = nil;

        // 오브젝트 대입

        calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];

구현부

    //날짜 처리

    //날짜 콤포넌트 취득

    unsigned int unitFlag= NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit|NSHourCalendarUnit|NSMinuteCalendarUnit|NSSecondCalendarUnit;

    comps=[calendar components:unitFlag fromDate:[NSDate date]];

    

    

    // 날짜 표시

//    dateView.text = [NSString stringWithFormat:@”%02d.%02d.    %02d:%02d.%02d “,comps.month,comps.day,comps.hour,comps.minute,comps.second];

    

    [dateLabel setString:[NSString stringWithFormat:@”%02d.%02d.    %02d:%02d.%02d “,comps.month,comps.day,comps.hour,comps.minute,comps.second]];

    NSLog(@”%02d.%02d.    %02d:%02d.%02d “,comps.month,comps.day,comps.hour,comps.minute,comps.second);