반응형

반응형

Documents폴더 경로 얻기.

1) 방법.

NSArray *paths = NSSearchPathDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentFolderPath = [paths objectAtIndex:0];

2) 방법.

NSString *documentsFolderPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]);



앱이름.app(bundle)

1)번 방법.

NSString *bundlePath = [[NSBundle mainBundle] resourcePath];


2)번 방법.

NSString *bundlePath = [[NSBundle mainBundle] bundlePath];



반응형

'IPHONE' 카테고리의 다른 글

Segue 사용하기.  (0) 2013.12.11
NSFetchRequest 에 Entity 지정 방법.  (0) 2013.12.11
아이폰 앱 등록 절차  (0) 2013.12.10
Core Graphics 이미지 그리기.  (0) 2013.11.30
Sizes of iPhone UI Elements  (0) 2013.11.29
Posted by 컴스터
,

아이폰 앱 등록 절차

IPHONE 2013. 12. 10. 11:03
반응형

아이폰 앱 등록

  • 인증서(Certificates) 생성(Developer, Distribution)
  • App ID 생성
  • Provisioning Profile 생성(Developer, Distribution)
  • 인증서와 프로파일 다운로드하여 Key Chain과 Organizer에 등록
  • XCode에서 Scheme 생성(예 : Distribution)
  • XCode의 Product 메뉴에서 Edit Scheme 선택
  • Distribution으로 변경
  • 프로젝트 속성에서 Distribution 속성으로 변경,Profile 변경
  • 빌드
  • app 파일 생성되면 zip으로 압축
  • 등록 절차 진행


반응형
Posted by 컴스터
,
반응형

- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGFloat red[4] = {1.0f, 0.0f, 0.0f, 1.0f}; // 색깔 지정.
    CGContextSetStrokeColor(context, red);
   
    // 직선
    CGContextBeginPath(context);
    CGContextMoveToPoint(context, 50.0f, 50.0f);
    CGContextAddLineToPoint(context, 150.0f, 150.0f);
    CGContextStrokePath(context);
   
    // 원
    CGContextBeginPath(context);
    CGContextAddArc(context, 80, 50, 50, 0, 2*M_PI, YES);
    CGContextStrokePath(context);
   
    // bezier 곡선
    CGContextBeginPath(context);
    CGContextMoveToPoint(context, 50.0f, 300.0f);
    CGContextAddCurveToPoint(context, 0, 0, 50, 150, 100, 100);
    CGContextStrokePath(context);
   
    // 삼각형
    CGContextBeginPath(context);
    CGContextMoveToPoint(context, 70.0f, 30.0f);
    CGContextAddLineToPoint(context, 100.0f, 50.0f);
    CGContextAddLineToPoint(context, 40.0f, 50.0f);
    CGContextClosePath(context);
    CGContextStrokePath(context);
}

다음 메소드 호출시 다시 그린다.

- (void)setNeedsDisplay;

- (void)setNeedsDisplayInRect:(CGRect)aRect;

반응형

'IPHONE' 카테고리의 다른 글

Documents 폴더의 경로 얻기. bundle 폴더 접근 방법  (0) 2013.12.10
아이폰 앱 등록 절차  (0) 2013.12.10
Sizes of iPhone UI Elements  (0) 2013.11.29
문서 기호 가이드  (0) 2013.11.20
아이콘 뱃지 달기.  (0) 2013.11.14
Posted by 컴스터
,

Sizes of iPhone UI Elements

IPHONE 2013. 11. 29. 10:08
반응형

How to detect the current device size (and how to tell if it's an iPhone 5)

Element iPhone 4S (and earlier) iPhone 5
Window (including status bar) 320 x 480 pts 320 x 568 pts
Status Bar
(How to hide the status bar)
20 pts 20 pts
View inside window
(visible status bar)
320 x 460 pts 320 x 548 pts
Navigation Bar 44 pts 44 pts
Nav Bar/Toolbar Icon white icon - up to 20 x 20 pts (transparent PNG)
Tab Bar 49 pts 49 pts
Tab Bar Icon up to 30 x 30 pts (transparent PNGs)
Text Field 31 pts 31 pts
Height of a view inside
a navigation bar
416 pts 504 pts
Height of a view inside
a tab bar
411 pts 499 pts
Height of a view inside
a navbar and a tab bar
367 pts 455 pts
Portrait Keyboard (English) 320 x 216 pts 320 x 216 pts
Landscape Keyboard (English) 480 x 162 pts 568 x 162 pts
Launch Image
(Launch Image Sizes
for iPhone & iPad
)
640 x 960 pixels 640 x 1136 pixels
This page is available as an interactive version in the idev101 app!

Points vs. Pixels

Apple introduced retina displays starting with the iPhone 4. These have twice as many screen pixels as previous iPhones. You don't have to modify your code to support high-res displays; the iOS coordinate system uses points rather than pixels, so the dimensions and position in points of all UI elements remains the same across all devices.

iOS supports high resolution displays via the scale property on UIScreen, UIView, UIImage, and CALayer classes. If the object is displaying high-resolution content, its scale property is set to 2.0. Otherwise it defaults to 1.0.

Retina Graphics

To support high-resolution graphics on devices with retina displays, create two versions of the image: a standard size image, and a double-sized image with "@2x" added to the name:

Standard Size: High Resolution:

button.png
60 x 20

button@2x.png
120 x 40

To refer to an image in your code (or in Interface Builder), use the filename of the standard sized image. iOS will automatically detect and use the @2x version if the device supports it:

imageView.image = [UIImage imageNamed:@"button.png"];

Adjusting Sizes

Click here to see how to adjust View Frames and Bounds.

Additional References


반응형

'IPHONE' 카테고리의 다른 글

아이폰 앱 등록 절차  (0) 2013.12.10
Core Graphics 이미지 그리기.  (0) 2013.11.30
문서 기호 가이드  (0) 2013.11.20
아이콘 뱃지 달기.  (0) 2013.11.14
Alpha 값 적용된 이미지 얻기.  (0) 2013.11.09
Posted by 컴스터
,

문서 기호 가이드

IPHONE 2013. 11. 20. 14:19
반응형



반응형

'IPHONE' 카테고리의 다른 글

Core Graphics 이미지 그리기.  (0) 2013.11.30
Sizes of iPhone UI Elements  (0) 2013.11.29
아이콘 뱃지 달기.  (0) 2013.11.14
Alpha 값 적용된 이미지 얻기.  (0) 2013.11.09
UIButton 텍스트 정렬 및 코너 라운드 처리 하기.  (0) 2013.11.06
Posted by 컴스터
,

아이콘 뱃지 달기.

IPHONE 2013. 11. 14. 12:34
반응형


뱃지 숫자 3 넣기.

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:3];


뱃지 사라지게 하기.

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

반응형
Posted by 컴스터
,
반응형
+ (UIImage *) setImage:(UIImage *)image withAlpha:(CGFloat)alpha{

    // Create a pixel buffer in an easy to use format
    CGImageRef imageRef = [image CGImage];
    NSUInteger width = CGImageGetWidth(imageRef);
    NSUInteger height = CGImageGetHeight(imageRef);
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

    UInt8 * m_PixelBuf = malloc(sizeof(UInt8) * height * width * 4);

    NSUInteger bytesPerPixel = 4;
    NSUInteger bytesPerRow = bytesPerPixel * width;
    NSUInteger bitsPerComponent = 8;
    CGContextRef context = CGBitmapContextCreate(m_PixelBuf, width, height,
                                                 bitsPerComponent, bytesPerRow, colorSpace,
                                                 kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);

    CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef);
    CGContextRelease(context);

    //alter the alpha
    int length = height * width * 4;
    for (int i=0; i<length; i+=4)
    {
        m_PixelBuf[i+3] =  255*alpha;
    }


    //create a new image
    CGContextRef ctx = CGBitmapContextCreate(m_PixelBuf, width, height,
                                                 bitsPerComponent, bytesPerRow, colorSpace,
                                                 kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);

    CGImageRef newImgRef = CGBitmapContextCreateImage(ctx);  
    CGColorSpaceRelease(colorSpace);
    CGContextRelease(ctx);  
    free(m_PixelBuf);

    UIImage *finalImage = [UIImage imageWithCGImage:newImgRef];
    CGImageRelease(newImgRef);  

    return finalImage;
}


반응형
Posted by 컴스터
,
반응형

// 수평정렬.

btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

// 수직정렬
btn.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;

// 라운드 처리.

btn.layer.cornerRadius = 5.0f;


반응형

'IPHONE' 카테고리의 다른 글

아이콘 뱃지 달기.  (0) 2013.11.14
Alpha 값 적용된 이미지 얻기.  (0) 2013.11.09
Creating a Glow Effect for UILabel and UIButton  (0) 2013.11.05
scrollView 코드로 이동하기.  (0) 2013.10.25
UIColor 유용한 카테고리.  (0) 2013.10.17
Posted by 컴스터
,
반응형

Creating a Glow Effect for UILabel and UIButton

One recent iPhone design mockup called for a glowing effect for a UIButton.

This can be accomplished with images, however I needed a series of buttons to have the same glow effect, and it can easily be accomplished with Core Graphics.

The first step is to include the Core Graphics headers:

1
#import <QuartzCore/QuartzCore.h>

Next, the effect is achieved by using a shadow with no offset (meaning the shadow will be directly underneath the text, not shifted down or to the right). The layer is then given a shadow radius & opacity to allow the shadow to bleed outward. Unsetting masksToBounds will allow the glow to be drawn even outside of the label’s frame. Finally the shadow color is set to either the foreground color or something a bit lighter.

1
2
3
4
5
6
UIColor *color = button.currentTitleColor;
button.titleLabel.layer.shadowColor = [color CGColor];
button.titleLabel.layer.shadowRadius = 4.0f;
button.titleLabel.layer.shadowOpacity = .9;
button.titleLabel.layer.shadowOffset = CGSizeZero;
button.titleLabel.layer.masksToBounds = NO;

This effect works on plain UILabel or the titleLabel property of a UIButton. You can see the results of the effect here:

Don’t go overboard with this. It’s a subtle effect, but looks great when used effectively.


반응형

'IPHONE' 카테고리의 다른 글

Alpha 값 적용된 이미지 얻기.  (0) 2013.11.09
UIButton 텍스트 정렬 및 코너 라운드 처리 하기.  (0) 2013.11.06
scrollView 코드로 이동하기.  (0) 2013.10.25
UIColor 유용한 카테고리.  (0) 2013.10.17
ios Localization.  (0) 2013.10.11
Posted by 컴스터
,
반응형

가로 2페이지 이동.


[scrollView setContentOffset:CGPointMake(320 * 2, 0.0f) animated:YES];

반응형
Posted by 컴스터
,


반응형