iOS에서 Document에 zip 파일을 넣어서 풀기


plist 에 UIFileSharingEnabled key를 추가 하고 YES로 설정 후 


앱을 실행하면 itunes application에서 파일 추가 가능. (아래 이미지는 이미 풀어진 스크린샷)


zip 압축 풀기는 아래 참조 

http://code.google.com/p/ziparchive/wiki/PageName

 

기존 문서에는 libz.1.2.3.dylib 넣으라고 나오는데 그냥 libz.dylib 넣으면 됨. 


끝. 



'iOS' 카테고리의 다른 글

JSONKit for iOS  (0) 2011.06.28
Objective-C Outlet  (0) 2010.08.07
UIView Flip 효과 - iPhone  (0) 2010.06.29
다운 받는 곳 
https://github.com/johnezang/JSONKit

사용법

#import "JSONKit.h"

... 


NSString *filePath = [[NSBundle mainBundle] pathForResource:@"items" ofType:@"json"];   

NSString *a = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];

    

// 클래스의 종류 내용보기 

//    NSLog(@"class:%@ a:%@",[a class], a);

    

// JSON NSArray NSDictionary 변환 

NSArray *array = [a objectFromJSONString];

NSLog(@"class: %@, %d", [array class], [array count]);

    

// Array에서 Dictionary 가져오기 

NSDictionary *dic = [array objectAtIndex:0];

NSLog(@"dic name:%@", [[dic valueForKey:@"name"] description]);

 

'iOS' 카테고리의 다른 글

iOS에서 Document에 zip 파일을 넣어서 풀기  (0) 2012.05.16
Objective-C Outlet  (0) 2010.08.07
UIView Flip 효과 - iPhone  (0) 2010.06.29
objective-c 에서는 다른 객체를 참조 하는 변수를 outlet 이라고 부른다. 
outlet 은 GUI 구성을 하는 Interface Builder 에서 변수로 다른 객체를 연결 할때 사용함. 

IBOutlet UIView *view2;


위와 같은 형태로 주로 사용되는데 
IBOutlet 에서 IB는 Interface Builder의 줄인말인듯. 

참조를 하기 위해서는 아래와 같이 선언하고 .m 에서 접근 하면 된다. 

@property (nonatomic, retain) IBOutlet UIView *view2;

'iOS' 카테고리의 다른 글

JSONKit for iOS  (0) 2011.06.28
UIView Flip 효과 - iPhone  (0) 2010.06.29
Protocols - Objective-C  (0) 2010.06.27
  


#pragma mark - Flip screen


- (void)flipAction:(id)sender

{

[UIView setAnimationDelegate:self];

[UIView setAnimationDidStopSelector:@selector

            (animationDidStop:animationIDfinished:finished:context:)];

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:0.75];

[UIView setAnimationTransition:([self.tableView superview] ? UIViewAnimationTransitionFlipFromLeft UIViewAnimationTransitionFlipFromRight)

forView:self.tableView cache:YES];

if ([instructionsView superview])

[instructionsView removeFromSuperview];

else

[self.tableView addSubview:instructionsView];


[UIView commitAnimations];

// adjust our done/info buttons accordingly

if ([instructionsView superview] == self.tableView)

self.navigationItem.rightBarButtonItem = doneButton;

else

self.navigationItem.rightBarButtonItem = flipButton;

}

'iOS' 카테고리의 다른 글

Objective-C Outlet  (0) 2010.08.07
Protocols - Objective-C  (0) 2010.06.27
서버에서 다운 받기 - Objective-c  (0) 2010.03.11
Protocol : 메소드 선언의 집합

java의 interface라는 개념이 Protocol을 도입한 개념임. 

서로 다른 객체가 같은 메소드의 집합을 가지는 경우, 상속 관계는 아님. 

프로토콜은 메소드의 명칭들을 정해 놓으면 그 프로토콜을 따를 때 메소드의 명칭들이 같아지므로 사용성이 좋아지는 것을 목적으로 한다. 



'iOS' 카테고리의 다른 글

UIView Flip 효과 - iPhone  (0) 2010.06.29
서버에서 다운 받기 - Objective-c  (0) 2010.03.11
xcode 에서 회사 이름 바꾸기  (0) 2010.01.01
erica 예제 c3-06-Synchronous Downloads


NSURL *url = [NSURL URLWithString: [urlArray objectAtIndex:[which intValue]]];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSURLResponse *response;
NSError *error;

NSData* result = [NSURLConnection sendSynchronousRequest:
theRequest
theRequest returningResponse:&response error:&error];



덤으로 무비 플레이어

- (void) startPlayback : (id) sender
{
MPMoviePlayerController* theMovie=[[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:self.savePath]];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
[theMovie play];
}

'iOS' 카테고리의 다른 글

Protocols - Objective-C  (0) 2010.06.27
xcode 에서 회사 이름 바꾸기  (0) 2010.01.01
아이폰 강좌  (0) 2009.12.24
Xcode에서 회사 이름 바꾸기

//
//  UITableView.h
//
//  Created by myname on 10. 1. 1..
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//


주석에서 회사 이름을 변경하려면 터미널에서 아래 명령어를 실행하면 된다.

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ORGANIZATIONNAME="__MyCompanyName__";}'

'iOS' 카테고리의 다른 글

서버에서 다운 받기 - Objective-c  (0) 2010.03.11
아이폰 강좌  (0) 2009.12.24
Objective-C  (0) 2009.11.13

 

 

스프링노트에서 문서 올리기 테스트 중입니다. ..  이문서는 완료 되지 않았습니다.

Objective-C

 

 

참고

http://www.otierney.net/objective-c.html(영문)

 

 

이 글은 스프링노트에서 작성되었습니다.

'iOS' 카테고리의 다른 글

서버에서 다운 받기 - Objective-c  (0) 2010.03.11
xcode 에서 회사 이름 바꾸기  (0) 2010.01.01
Objective-C  (0) 2009.11.13

iphone_hand-266x300.png



Objective-C의 기본적인 클래스 형태는 아래와 같다 .

[code]
//선언
@interface Song:NSObject
{
NSString *name; // 인스턴스 변수
NSString *age;
}
- (NSString*) name; // 인스턴스 메소드
- (NSString*) age;


//사용
Song mySong; //선언

[mySong name];

[/code]


Objective-C는 동적인 언어
런타임시에 객체가 변할수 있음.
id 라는 모든 객체를 포인팅 가능한 형이 있음 void와 유사함

Objective Messaging
메세지를 보낸다는 의미로 표현함

호출법
[receiver message]
받을 대상

비교
[myRect setWidth:10.0 height:17.0] <- 적용방법
- (void) setWidth:(float)width  height:(float) height  <- 메소드 형태

Polymorphism 다형성
연산자 오버로딩은 지원하지 않음



'iOS' 카테고리의 다른 글

서버에서 다운 받기 - Objective-c  (0) 2010.03.11
xcode 에서 회사 이름 바꾸기  (0) 2010.01.01
아이폰 강좌  (0) 2009.12.24

+ Recent posts