Language/Objective-C 18

[UIViewScroll] view and scroll Down

// 텍스트필드 포커스시 키보드 비활성화 기능 버튼 활성화 및 스크롤 이동 - (void)textFieldDidBeginEditing:(UITextField *)textField { NSInteger frameSizeHeight = 460 - 215; if (textField.tag < 3) { CGPoint bottomOffset = CGPointMake(0, 0); [scrollView setContentOffset: bottomOffset animated: YES]; } else { CGPoint bottomOffset = CGPointMake(0, 200); [scrollView setContentOffset: bottomOffset animated: YES]; } scrollView.frame ..

Day of Week 게산하기

iphone에서 NSDate를 입력하고 그날의 요일을 얻어 오는 간단한 프로그램. // return DayofWeek with indate of offset -(NSString *)findDayofWeek:(NSDate*)inDate offsetDays:(NSInteger)offs{ NSDate *calDate = [[NSDate alloc] initWithTimeInterval:(offs*60*60*24) sinceDate:inDate]; NSLog(@"calDate = %@",calDate); NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease]; [df setDateFormat:@"yyyy-MM-dd HH:mm:ss zzzz"]; [..

Class / Protocol / Category for Objective-C

클래스 클래스는 항상 NSObject로부터 상속을 받아야 한다. ( 객체 생성, 정리 등 모든 관리에 필요한 기능들이 NSObject에 정의가 되어 있다. ) 헤더파일은 .h , 구현파일은 .m 이다. 클래스 인터페이스 정의(.h) #import @interface ClassName : NSObject { int member; // 멤버변수들; } @property (retain) int member; + 클래스메서드; - 인스턴스메서드; @end 멤버변수들은 괄호 안에 선언을 해주며, getter, setter 메시지를 자동으로 생성해주기 위해서는 @property 에 정의를 해주어야 한다. ( @property에 정의해준 항목은 .m 파일에서 @syntyesize 하고 짝을 이루도록 해줘야 한다. )..