본문 바로가기

전체 글1049

iPhone 동영상 재생 - MPMoviePlayerViewController iOS 3.1.3 까지는 동영상 재생을 원할때 MPMoviePlayerController를 사용했었습니다. iOS 3.2 이상 버전에서는 MPMoviePlayerViewController가 추가되었습니다. 아래와 같이 사용하면 3.1.3 이전 버전과 3.2 이상 버전에서 모두 동작하도록 할 수 있습니다. 제 경우에는 UIViewController에 아래 코드를 추가하고 동영상 재생을 원하는 곳에서 노티피케이션으로 알려서 재생을 하는 방식으로 처리했습니다. - (void) moviePlayBack:(NSNotification *)noti { NSURL *movieURL = (NSURL *)[[noti userInfo] objectForKey:@"url"]; if ([[[UIDevice currentDevi.. 2012. 5. 8.
맥어드레스 가져오기 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273#include #include #include #include ... - (NSString *)getMacAddress{ int mgmtInfoBase[6]; char *msgBuffer = NULL; size_t length; unsigned char macAddress[6]; struct if_msghdr *interfaceMsgStruct; struct.. 2012. 5. 2.
Custom AlertView 잠시 일이 생겨서, 일좀 하고 왔습니다. ㅇㅅㅇ.. 요 아래 비슷한거 만들고 왔어요. 그래서, 바로 요아래와 같은걸 만들어보도록합시다..!! 꺄야야야... 근데과연 몇강까지 갈지 궁금한 "기타 잡다한것 강의..."몇강까지 갈까가, 아니라 이름 바꾸어서 끊어버렸습니다 ㅇㅅㅇ...!!! 에잇, 중간에 일하느라 뭘 쓰고 있었는지 까먹어서강의가 엉망이 되었네요 ㅠㅜ ========================================================== 오늘의 결과물 === AlertView + TableView 되겠습니다...! 오늘의 아이폰 결과물만 거의 3개... 어제 루아강의를 못쓴것이 한으로 남아, 쭉쭉 올립니다 >ㅅㅅ< 뿌뿌뿌뿌뿌뿌 그리고, 이제, 요 아래부분을 ... 일이 또 생겼넴.. 2012. 4. 29.
How does UITableViewCell reorder, expand/shrink work ? So you spent way too much time in figuring out how to make UITableview collapsible, you are at the right tutorial.This sample code, I have written is a more like a template which developers can take and use in their own application customize it according to their need. It basically deals with TableView property of reordering, expanding and shrinking. Here are some screenshots which display the w.. 2012. 4. 28.
Animate UITableView Cell Height Change NERD ALERT! This is a tech article, the faint of heart should browse on… Overview Well this is going to be a fairly short article, but I just wanted to share with you a snippet of magic I discovered quite some time ago. It is something that I posted on StackOverflow and to date is the most up-votes I have received on there, with votes coming in pretty much every day. The magic is in how you can .. 2012. 4. 28.
TextField 특정 문자만 사용하도록 하기 Xcode의 TextField 사용할때 특정 문자만 입력 받도록 하기 위해서는 다음과 같이 한다. 예) 숫자와 영문자만 입력 받기 #define LEGAL_TEXT@"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz " - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSCharacterSet *cs = [[NSCharacterSet characterSetWithCharactersInString:LEGAL_TEXT] invertedSet]; NSString *filt.. 2012. 4. 28.
objective c 수학함수 Objective-C 에서 가장 많이 쓰는 수학함수 모음입니다. ceil() – 올림값 NSLog(@"ceil(1.2) : %0.2f", ceil(1.2)); -> ceil(1.2) : 2.00 NSLog(@"ceil(1.8) : %0.2f", ceil(1.8)); -> ceil(1.8) : 2.00 NSLog(@"ceil(1.2) : %0.2f", ceil(-1.2)); -> ceil(-1.2) : -1.00 NSLog(@"ceil(1.8) : %0.2f", ceil(-1.8)); -> ceil(-1.8) : -1.00 floor() – 버림값 NSLog(@"floor(1.2) : %0.2f", floor(1.2)); -> floor(1.2) : 1.00 NSLog(@"floor(1.8) : %0.2f.. 2012. 4. 28.
iPhone UITableView with animated expanding cells tutorial Hello everyone, This is a tutorial which will go over creating a UITableview where the cells will expand and contract with user interaction. This is a preview of the project: - Before any cell is selected - - After a cell is selected – Prerequisits: Before beginning this tutorial you should be familiar with basics of development and especially the basics of working with UITableViews. Lets get St.. 2012. 4. 26.
테이블뷰 마지막 셀보이기(카카오톡 처럼) [table reloadData]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[table numberOfRowsInSection:0] - 1 inSection:0]; [table scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:NO]; 2012. 4. 26.
TableView에서 긴글을 표시할때 Row 높이를 다이나믹하게 조정하기 TableView를 이용해서 SNS를 개발 하기위해 선두지점에 있는 Facebook 앱을 보았다. 이렇게 Label이 길수록 TableView cell row가 길게 나왔다. 이렇게 할려면 글을 길이를 계산해서 row의 높이를 계산해야 한다. #define FONT_SIZE 14.0f #define CELL_CONTENT_WIDTH 320.0f #define CELL_CONTENT_MARGIN 10.0f 일단 사이즈를 계산하기 위해 고정적인 정보를 정의 했다. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; { NSString *text = [items objectAtIndex:[i.. 2012. 4. 26.
Custom segmented controls 주제 : 세그먼트 컨트롤을 커스텀 한다. Cocoa 터치 프레임워크에는 다음 4가지 타입의 세그먼트 컨트롤이 존재한다. 색상 및 디자인은 변경이 불가능하다. Apple 문서를 보면 세그먼트 컨트롤의 경우 단순한 버튼 그룹이라고 소개하고 있다. 때문에 버튼을 이용해서 세그먼트 컨트롤을 만들 수 있다. 커스텀 세그먼트 컨트롤 헤더 파일 먼저 정의된 헤더 파일을 살펴 보자. CustomSegmentedControlDelegate라는 delegate를 선언하고 buttonFor:atIndex:메서드를 선언한다. 이는 델리게이터가 실제 이미지를 드로잉하는 부분을 위임하게 된다. optional 델리게이터 메서드는 이벤트에 대한 액션(버튼 클릭시) 처리를 해준다. buttons는 세그먼트 컨트롤의 구성요소인 버튼을.. 2012. 4. 25.
Cropping Images using Graphic Contexts 주제 : Core Graphics API 사용해 이미지를 자르고 늘리는 작업을 한다. 이미지 늘리기 다음은 1px을 가지는 이미지를 UIImage 클래스가 지원하는 stretchableImageWithLeftCapWidht:topCapHeight: 메서드를 이용해 이미지 뷰를 만드는 방법이다. 이와 같은 방법으로 패턴 이미지도 생성이 가능하고 간단하게 이미지를 변형이 가능하다. UIImage *image = [[UIImage imageNamed:@"1px-blue-divider.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]; UIImageView *imageView = [[[UIImageView alloc] initWithImage:image.. 2012. 4. 25.