본문 바로가기

아이폰

iOS 학습 시작 과거 몇년전에 아이폰/아이패드 프로그램을 개발한 적이 있었다. 그때는 처음 접하는 개념에 어려움이 좀 있었지만 익숙해지니 괜찮았던 기억이 있다. 그런데 그 뒤에 별로 다시 개발 할 일이 없어서 손을 놓고 있었는데 최근에 뭔가 개발하고픈 생각에 다시 한번 해보려 생각하고 Xcode를 새로 설치 하고 실행해보니… 이게뭐야?! 다 바꼈어!!! 인터페이스 빌더는 합쳐지고 뭔 스토리보드 란것도 생기고 샘플코드 다운 받아보니 멤버필드는 언더바를 붙이고.. 젠장… 다시 공부해야겠네… 과거에 썼던 글들을 보니 그냥 그때 그때 마다 메모 형식으로 쓴것들이라 좀 정리를 해서 다시 써야 겠다.
[iPhone] 아이폰 자동 잠금 해제하기 - (void)applicationDidFinishLaunching:(UIApplication *)application { application.idleTimerDisabled = YES; } 혹은 [UIApplication sharedApplication].idleTimerDisabled = YES;
[iPhone] UIColor 색상 각 구성데이터 가져오기 UIColor *lineColor = [UIColor redColor]; const CGFloat *components = CGColorGetComponents(lineColor.CGColor); NSString *msg = [NSString stringWithFormat:@"%f,%f,%f", components[0],components[1],components[2]];
[iPhone] 이미지 가져와서 그리기 CGContextRef context = UIGraphicsGetCurrentContext(); NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"imagefile.bmp" ofType:nil]; UIImage *img = [UIImage imageWithContentsOfFile:imagePath]; CGImageRef image = CGImageRetain(img.CGImage); CGRect imageRect; imageRect.origin = CGPointMake(15.0, 15.0); imageRect.size = CGSizeMake(25.0, 25.0); CGContextDrawImage(context, imageRect, imag..
[iPhone] UIView 캡쳐 UIGraphicsBeginImageContext(self.bounds.size); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage* image1 = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(image1, nil, nil, nil);
[iPhone] expected specifier-qualifier-list before 'virtual' .hpp 파일을 생성해서 #import를 했더니 이딴 에러가 등장했다. 해결방법은 모든 파일을 .m에서 .mm으로 변경하면 된다.
[iPhone] UITableViewCell에 높이 조절하기 테이블 셀의 높이가 각각 다른 테이블을 만드는중 문제가 생겼다. 테이블 셀의 뷰를 놓고 그 위에 텍스트 박스를 놓았는데 텍스트 내용의 길이에 따라서 높낮이를 조절해야 한다. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if ([indexPath row] == 0) { return 100; } return 80; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellId = @"cellId "; CellId..
[iPhone] UIImageView에 테두리 넣기 #import "QuartzCore/QuartzCore.h" [imgView.layer setBorderColor: [[UIColor blackColor] CGColor]]; [imgView.layer setBorderWidth: 1.0];