반응형
ShakeJ
MNWorld
ShakeJ
전체 방문자
오늘
어제
  • 카테고리 N
    • Contact
    • 🤔그냥이야기
    • 📷사진이야기
    • 제주도에서 한달을 살아보았다
    • 옛글 N
      • 👇Blog
      • 공지사항
      • 이슈 N
      • 생각들
      • 👇취미
      • 건프라
      • 👇Review
      • 노래리뷰
      • 영화리뷰
      • 👇Travel Story
      • 2011 도쿄여행기
      • 2013 Google IO
      • 2013 Jeju
      • 2014 HONGKONG
      • 2014 Jeju
      • 2014 Sanfransis..
      • 2015 Lombok
      • 2016 HONGKONG
      • 2017 Saigon
      • 국내여행기
      • Photo Story
      • Growth
      • 👇Server
      • Ruby on the Rai..
      • Frontend
      • FullStack (MEAN..
      • Ubuntu
      • 👇Android
      • 안드로이드 프로그래밍
      • 번역본
      • 내어플이야기
      • 코드창고
      • 👇iOS
      • 아이폰 프로그래밍
      • 맥북 이야기
      • 👇Microsoft
      • ASP.NET
      • Silverlight
      • 윈도우 이야기
      • 👇IT Story
      • 모바일 이야기
      • 하드웨어 이야기 N
      • 네트워크 이야기
      • 프로그래밍이야기
      • Database이야기
      • 클라우드이야기
      • 프론트 이야기
      • 마케팅이야기
      • 그래픽 작업
      • 블로그 팁

블로그 메뉴

  • GuestBook

공지사항

인기 글

태그

  • iOS 프로그래밍
  • shakej
  • 배너무료제작
  • 티스토리 초대장
  • 블로그 잡담
  • 블로그 이야기
  • 서울 출사지
  • 블로그 처음
  • asp.net
  • 블로그 운영하면서
  • 무료배너제작
  • D40 사진
  • 블로그 만들기
  • 랩
  • 블로그 초보
  • 초대장
  • 티스토리 팁
  • 블로그 운영
  • 배너제작
  • 티스토리
  • 블로그 팁
  • 블로그 꾸미기
  • 윈도우폰7
  • 블로그 시작하기
  • 풍경사진
  • MNWorld
  • 배너교환
  • 블로그 관련
  • 블로그 운영하기
  • 안드로이드 어플 추천

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
ShakeJ

MNWorld

옛글/아이폰 프로그래밍

iOS에서 나인패치(배경리사이즈) 적용하기

2012. 7. 20. 18:00
반응형

안드로이드에서는 나인패치가 없는 줄 알았는데,  (안드로이드에서는 작은 배경을 직선으로 늘려서 이미지가 깨지지 않고 적용) UIImage 에도 비슷한 메서드가 존재하네요. 


+(UIImage*)ninePatchedImage:(UIImage*)kOriginalImg Offset:(float)kOffset{

    CGSize kSize = kOriginalImg.size;

    return  [kOriginalImg resizableImageWithCapInsets:UIEdgeInsetsMake(aOffset, aOffset, kSize.height-aOffset, kSize.width-aOffset)];

}


resizableImageWithCapInsets 
[ iOS Document Reference]


resizableImageWithCapInsets:

Creates and returns a new image object with the specified cap insets.

- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets

Parameters

capInsets

The values to use for the cap insets.

Return Value

A new image object with the specified cap insets.

Discussion

You use this method to add cap insets to an image or to change the existing cap insets of an image. In both cases, you get back a new image and the original image remains untouched.

During scaling or resizing of the image, areas covered by a cap are not scaled or resized. Instead, the pixel area not covered by the cap in each direction is tiled, left-to-right and top-to-bottom, to resize the image. This technique is often used to create variable-width buttons, which retain the same rounded corners but whose center region grows or shrinks as needed. For best performance, use a tiled area that is a 1x1 pixel area in size.

Availability

  • Available in iOS 5.0 and later.

Declared In

UIImage.h

반응형
저작자표시 비영리 변경금지

'옛글 > 아이폰 프로그래밍' 카테고리의 다른 글

xCode iCloud 연동 소스 배포  (0) 2012.07.23
Code signing is required for product type 'Application' in SDK 'iOS5.1' 에러처리  (0) 2012.07.23
iCloud Guide (XCode iCloud 적용가이드)  (0) 2012.07.17
xCode iCloud iOS/MAC App에 적용하기 Part1  (0) 2012.07.06
[iOS프로그래밍] NSString Split(Token 으로 자르기)  (0) 2012.07.06
    추천글👇
    • [📷사진이야기] 붉은 호치민의 노을
    ShakeJ
    ShakeJ

    티스토리툴바