Dev 기타2011. 10. 24. 18:58


터미널에서 레티나 이미지(@2x.png) svn add 할 때 @2x 인식 못할 때에 사용

 for f in *@2x.png; do svn add $f@; done


Posted by 놀란
Dev 기타2011. 10. 13. 15:30

svn 디렉토리가 꼬였을 경우, 커맨드 창에서 .svn 파일(디렉토리)를 일괄 삭제해야할 때가 있다.


그때... find . -name .svn -exec rm -rf {} \; 

하면 현재 선택된 디렉토리 밑에 있는 모든 .svn 을 삭제하게 됨.


Posted by 놀란
Dev/iOS2011. 10. 5. 14:16

Property 옵션 값들이 계속 헷갈렸었는데....


@property (


  1. atomic OR nonatomic
    1. 이 두 속성중 하나를 선택하는 것으로 기본값은 atomic입니다. 이부분은 멀티스레딩에 관련된 부분으로 보통 nonatomic을 사용합니다. 자세한건 개발자 문서 참고
  2. assign OR retain OR copy
    1. setter에서 객체를 지정 받을때 
      1. assign의 경우 주소값만 지정받고
      2. retain의 경우 기존것을 release후 새로 받은걸 retain합니다.
      3. copy의 경우 기존것을 release후 새로 받은걸 copy합니다.
    2. 이부분은 setter에 관련있고 getter와는 관련 없습니다.
  3. readonly OR 없음
    1. readonly설정되면 setter가 없습니다. 말그대로 읽기 전용이죠


- 참고 - 문씨의블로그 (http://lab.smoon.kr/70)

Posted by 놀란
Dev/iOS2011. 9. 27. 16:07

CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(40));

[ImageView setTransform:landscapeTransform];


Posted by 놀란
Dev/iOS2011. 9. 27. 16:04


- (UIImage *)convertImageToGrayScale:(UIImage *)image { 

// Create image rectangle with current image width/height 

CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height);

// Grayscale color space 

CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();

// Create bitmap content with current image size and grayscale colorspace 

CGContextRef context = CGBitmapContextCreate(nil, image.size.width, image.size.height, 8, 0, colorSpace, kCGImageAlphaNone);

// Draw image into current context, with specified rectangle 

// using previously defined context (with grayscale colorspace) 

CGContextDrawImage(context, imageRect, [image CGImage]);

// Create bitmap image info from pixel data in current context 

CGImageRef imageRef = CGBitmapContextCreateImage(context);

// Create a new UIImage object  

UIImage *newImage = [UIImage imageWithCGImage:imageRef];

// Release colorspace, context and bitmap information 

CGColorSpaceRelease(colorSpace);

CGContextRelease(context);

CFRelease(imageRef);

// Return the new grayscale image 

return newImage;

}

파라미터를 추가하면 scale도 변경 가능하네요.


Posted by 놀란
Dev/iOS2011. 9. 23. 16:41


UIImage *origianlImage = [UIImage imageNamed:@"source.png"];

UIImage *flippedImage = [UIImage imageWithCGImage:originalImage.CGImage

scale:1.0 

orientaion:UIImageOrientationLeftMirrored];

orientaion 종류

typedef enum {

    UIImageOrientationUp,            // default orientation

    UIImageOrientationDown,          // 180 deg rotation

    UIImageOrientationLeft,          // 90 deg CCW

    UIImageOrientationRight,         // 90 deg CW

    UIImageOrientationUpMirrored,    // as above but image mirrored along other axis. horizontal flip

    

    UIImageOrientationDownMirrored,  // horizontal flip

    UIImageOrientationLeftMirrored,  // vertical flip

    UIImageOrientationRightMirrored, // vertical flip

} UIImageOrientation;

Posted by 놀란
Dev/iOS2011. 8. 30. 12:02

특정 instance 의 클래스 여부를 확인한다.

- (BOOL)isKindOfClass:(Class)aClass

retrun 값은 BOOL (1, 0) - 해당 클래스에 속하면 YES(1), 아니면 NO(0)

사용법:

id result  일 경우,

[result isKindOfClass:[NSArray class]];


- result가 NSArray 인지 확인!

Posted by 놀란
맛집/강남맛집2011. 8. 21. 16:59

서초역과 예술의전당 방면으로 내려오다 보면 있는 수제버거집입니다.
위치가 애매해서 지도 보고 잘 찾아가셔야 될 것 같네요.
바로 앞에 놀이터가 있으니 놀이터를 찾으시면 좀 더 쉽게 찾으실 수 있을꺼에요.
생긴지는 몇년 됐고, 올초에는 윙스푼에도 등록이 된 검증된 맛집입니다!

주력메뉴는 길벗버거 인데 양이 꽤나 많습니다.
여자분들 이거 혼자 다 드시면 인정할께요. ^^;

길벗버거 전경

길벗 메뉴판입니다.

정말 맛있었던 산 미구엘 생맥주!

길벗버거!

이건 조금 작은 길벗쥬니어 입니다.

이렇게 2인분 먹었네요!

아직 공식적으로는 주지 않지만 버거 케이스를 달라고 하시면 주신다고 합니다.

햄버거는 베어먹어야 제맛!!

 

Posted by 놀란
맛집/기타2011. 8. 17. 03:44

 

부산역에 갈 때마다 꼭 들르는 집입니다.
이번 여름휴가에도 도착하자마자 혼자임에도 불구하고 먹고 왔습니다.

맛이 깔끔하게 잘 나오는 집이에요.
부산역에 도착하셔서 한그릇 드시고, 여행 시작하시면 좋을 듯 싶습니다.
대부분 부산사람들은 돼지국밥 위에 정구지(부추) 듬뿍 올려서 드시더라고요.

부산 역에서 택시정거장 건너편 편의점 옆 골목으로 들어가시면 됩니다.

조금만 걸어가시면 오른쪽에 본전 돼지국밥 집이 있어요!!

기본은 돼지국밥.6000원 입니다.다른 돼지국밥집과 달리 따로국밥 식으로 밥이 따로 나옵니다.

수 많은 방문 흔적들. 개그맨들이 많이 왔나봐요.

 

 

Posted by 놀란
Dev/iOS-cocos2d2011. 8. 5. 12:03

좌표(터치)를 이용하여 특정 스프라이트 터치 체크하는 방법

체크는 CGRectContainsPoint 메소드 사용. 참고:( http://goo.gl/BQ2HQ )

CGRectContainsPoint 에 필요한 인자값은 Rect 와 Point

Rect(사각형 스프라이트) 안에 Point 가 있는지 체크하는 메소드 입니다.

사각형 범위를 가져오기 위해서는 해당 sprite의 position과 width, height 를 이용하여 범위를 가져와야 합니다.

cocos2d 에서는 이것을 boundingBox 메소드를 이용하여 쉽게 가져올 수 있습니다.

CGPoint touchPoint = [touch locationInView:[touch view]];

touchPoint = [[CCDirector sharedDirector] convertToGL:touchPoint];

CCSprite *sprite = [CCSprite spriteWitheFile:@"파일명"];

if (CGRectContainsPoint([sprite boundingBox], touchPoint)) {

    NSLog(@"해당 스프라이트 터치 성공.");

} else {

    NSLog(@"해당 스프라이트 터치 안됨.");

}


진작에 쓸걸... 그동안 position, width, height 계산한걸 생각하면.... -_-;;



Posted by 놀란