본문 바로가기

Development/IOS & Mac

ViewController를 View처럼 넣기~! 간혹 ViewController로 만들어진 라이브러리를 합쳐서 사용하고 싶을 때가 있다.하지만 view만 가져와서 넣으면 정상적으로 작동하지 않는다. 정상적으로 작동하게 하려면 아래와 같이 viewController를 넣어주면 된다. [self addChildViewController:imagePickerViewController];[self.view addSubview:imagePickerViewController.view]; 더보기
iOS @autoreleasepool 사용하기 @autoreleasepool 키워드는 메모리를 효율적으로 관리하고 싶을 떄 사용하면 좋을 듯하다. 만약 아래와 같은 코드가 있다고 하자 그러면 for문이 끝난 시점에서 메모리를 해제를 할 것이다. for (/* a long time */) { NSMutableString *s = [NSMutableString string]; // ... } 위의 코드에 @autoreleasepool 를 사용한 코드를 보자 for (/* a long time */) { @autoreleasepool { NSMutableString *s = [NSMutableString string]; // ... }//여기서 메모리 해제가 됨 } 이제 autoreleasepool로 인해 for문이 끝난 시점이 아닌 즉시 메모리를 해제를.. 더보기
iOS Background 실행시키기 iOS에서 Home 버튼을 눌러도 진행중인 처리작업을 중단하지 않고 실행 할 수 있게 만드는 방법이다. (본인의 경우 background 상태가 될 떄 처리되도록 만들었다. ) - (void) applicationDidEnterBackground:(UIApplication *)application { UIBackgroundTaskIdentifier taskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{[[UIApplication sharedApplication] endBackgroundTask:taskId]; }]; }//end applicationDidEnterBackground Method backg.. 더보기
iCarousel 라이브러리에서 iCarouselTypeWheel 모드일 때 선택된 View 앞으로 보이게 하기 1. iCarousel.m 코드를 보면 2. - (CATransform3D)transformForItemViewWithOffset:(CGFloat)offset 가 있다.3. 여기서 Switch 문에서 아래의 항목을 찾자 case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: 4. return CATransform3DTranslate(transform, 0.0f, -radius, offset * 0.01f);코드를 아래와 같이 바꾼다.return CATransform3DTranslate(transform, 0.0f, -radius, 0.01f); 더보기
Cocos2d-X iOS에서 완전히 종료시키기 본인의 경우 Cocos2d-x 와 iOS native를 ViewController 단위로 실행하게 만들면서 알게된 문제입니다.Cocos2d x 의 버전은 cocos2d-2.0-x-2.0.4 입니다. 원래라면 CCDirector::sharedDirector()->end(); 호출을 하면 Cocos2d-x와 관련 된 모든 것들이 종료가 되어집니다. 하지만 프레임은 떨어지지 않지만 다시 실행시키면 시킬 수록 터치의 반응속도가 점점 떨어지는 것을 발견 원인은 CCDirectorCaller 클래스에서 문제가 있었습니다. +(id) sharedDirectorCaller{ if (s_sharedDirectorCaller == nil) { s_sharedDirectorCaller = [CCDirectorCaller n.. 더보기
[IOS Library] MPFoldTransition Flip 과 Fold 효과를 쓸수 있는 라이브러리 이다.이동하기 FeaturesConvenience methods to extend UIViewController to present/dismiss a view controller modally using fold/flip transitionsConvenience methods to extend UINavigationController to push/pop view controllers onto the navigation stack using fold/flip transitionsConvenience methods to transition between any 2 UIViewControllers or UIViews3 Custom UIStoryboardSeg.. 더보기
[IOS Library] SLExpandableTableView 펼쳐지는 TableView이다. 간단해서 이식하기 좋다. SLExpandableTableView SLExpandableTableView is a UITableView subclass that gives you easy access to expandable and collapsable sections by just implementing a few more delegate and dataSource protocols. 더보기
[IOS Library] Slide-Menu 정말 슬라이드 되는 메뉴기능만 필요할떄 유용하다.~! iOS-Slide-MenuSetupSwitch ViewControllerEnable/Disable Left/Right MenuPublic PropertiesPublic MethodsCustom Animations 더보기
iOS 파일 관련 정리 File이 있는지 체크하기NSFileManager *filemgr; filemgr = [NSFileManager defaultManager]; if ([filemgr fileExistsAtPath: @"/tmp/myfile.txt" ] == YES) NSLog (@"File exists"); else NSLog (@"File not found");File 옮기기NSFileManager *filemgr; filemgr = [NSFileManager defaultManager]; if ([filemgr moveItemAtPath: @"/tmp/myfile.txt" toPath: @"/tmp/newfile.txt" error: NULL] == YES) NSLog (@"Move successful"); else.. 더보기
[IOS Library] SSZipArchive Objective C에서 Zip관련 라이브러리리 이다. SSZipArchiveSSZipArchive is a simple utility class for zipping and unzipping files. Features:Unzipping zip filesUnzipping password protected zip filesCreating zip filesAppending to zip filesZipping filesZipping NSData with a filenameWorks in ARC and non-ARC projects 이동하기 더보기