NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *date = [NSDate date]; NSDateComponents *hourDate = [gregorian components:kCFCalendarUnitHour fromDate:date]; NSDateComponents *minuteDate = [gregorian components:kCFCalendarUnitMinute fromDate:date]; NSDateComponents *secondDate = [gregorian components:kCFCalendarUnitSecond fromDate:date]; int ho..
//장면 전환 효과들 중에 옆으로 밀려서 나오고 스르륵 하고 그런효과들.. 책장 넘기는것 같은 효과 같은건 UIAnimationTransition #import CATransition *transition; // First create a CATransition object to describe the transition transition = [CATransition animation]; // Animate over 3/4 of a second transition.duration = 0.75; // using the ease in/out timing function transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaT..
//웹에서 이미지 불러와서 표시 //http://imgmovie.naver.com/mdi/mi/0490/49008_P51_144449.jpg UIImage *img = [[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"http://imgmovie.naver.com/mdi/mi/0490/49008_P51_144449.jpg"]]] retain]; if (img != nil) { // Image was loaded successfully. [myImageView setImage:img]; [myImageView setUserInteractionEnabled:NO]; [img release]; // Release th..
//그냥 바로 html 문자열 보여주기 NSString *htmlString; htmlString = [NSString stringWithFormat:@"%@", @"Test String"]; myWebView.opaque = NO; myWebView.backgroundColor = [UIColor clearColor]; [self.myWebView loadHTMLString:htmlString baseURL:nil]; //웹상 URL을 읽어오려면 [self.myWebView loadRequest: [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.iphonedevsdk.com/forum/iphone-sdk-development/5573-ca..
-- XCode 4.2 부터 ARC 가 추가되어 좋은건 써야 겠기에 http://iphone.galloway.me.uk/iphone-sdktutorials/singleton-classes/ 참고 .m 에서는 아래 코드와 같이(TWEngine 을 자기 클래스 이름으로 ㅇ_ㅇ.) .h 에서는 NSCopying 프로토콜 추가 해야 될듯(선언은 +(TWEngine*)sharedTWEngine 만) static TWEngine *sharedTWEngineManager = nil; +(TWEngine*)sharedTWEngine { @synchronized(self) { if (sharedTWEngineManager == nil) sharedTWEngineManager = [[self alloc] init]; } ..
View Hierarchy - Manipulation • Add/remove views in IB or using UIView methods - (void)addSubview:(UIView *)view; - (void)removeFromSuperview; • Manipulate the view hierarchy manually: - (void)insertSubview:(UIView *)view atIndex:(int)index; - (void)insertSubview:(UIView *)view belowSubview:(UIView *)view; - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)view; - (void)exchangeSubviewA..
UIApplicationDelegate • Xcode project templates have one set up by default • Object you provide that participates in application lifecycle • Can implement various methods which UIApplication will call • Examples: - (void)applicationDidFinishLaunching:(UIApplication *)application; - (void)applicationWillTerminate:(UIApplication *)application; 홈 버튼 눌렀을때(어플 종료전에 후다닥 처리해야 될 사항들) - (void)applicationW..
어떻게 알아 듣지도 못하는 영어로 강의하는 Stanford 자료(Itune U에 무료로 올라가 있음)가 공부하는데 도움이 더 되는듯 ㅠ_ㅠ + alloc ■ Class method that knows how much memory is needed (alloc 은 메모리 할당 과정) - init ■ Instance method to set initial values, perform other setup Obj-C에선 dealloc 을 직접 호출 하는 일이 없음(한가지 예외가 존재하긴 함.. 아래 코드) - (void)dealloc { // Do any cleanup that’s necessary // ... // when we’re done, call super to clean us up [super de..
----------------------------------------------------------------------------------------------------------------------------------------------------------------- error : No such file or directory iPhone 프로그래밍 할때 .m 과 .h 파일을 중복해서 만들기 귀찮을때 NSObject 의 subclass 로 Cocoa Class 로 생성 시킬때 접하게 되는 문제 #import 해당 문장을 아래와 같이.. #import ---------------------------------------------------------------------------..