u 오브젝트의 메모리 할당과 초기화

n         객체생성시 요구사항

동적으로 새로운 객체를 메모리에 할당

새롭게 메모리에 할당된 객체에 적절한 값들로 초기화

작성예

id anObject = [SomeClass alloc];

[anObject init];

[anObject someOtherMessage];

간략화

id anObject = [[SomeClass alloc] init];

[anObject someOtherMessage];

반환값 체크

id anObject = [[SomeClass alloc] init];

if ( anObject )

[anObject someOtherMessage];

else

...

 

n         NSObject alloc, allocWithZone

NSObject는 모든 클래스가 상속받게되는 최상위 클래스 (자바의 Object클래스)

생성한 클래스와 클래스내의 인스턴스 변수들을 위한 메모리 공간 확보

확보한 메모리공간을 생성한 인스턴스변수가 가르키도록 지시(Pointer)

모든 인스턴스 변수들의 값을 0으로 세팅

 

n         초기화 메소드 구현

초기화 인스턴스 메소드의 명칭은 init로 시작

인자가 없는 초기화 메소드는 init:

인자가 있는 초기화 메소드는 initMethodName:

 

n         초기화 메소드 작성예

- 인자가 없는 경우

- (id)init {

self = [super init];

if (self) {

creationDate = [[NSDate alloc] init];

}

return self;

}

 

 

- 인자가 있는 경우

 

- (id)initWithImage:(NSImage *)anImage {

NSSize size = anImage.size;

NSRect frame = NSMakeRect(0.0, 0.0, size.width, size.height);

self = [super initWithFrame:frame];

If (self) {

image = [anImage retain];

}

return self;

}

 

n         메모리확보와 초기화의 결합

convenience constructors를 사용함으로서 메모리 자동해제(autorelease)를 적용

자동해제의 경우 직접해제를 할경우 크래시 발생

Posted by 김반장78
,

 

u 클래스 정의

n         Interface : 한 클래스의 메소드와 인스턴스 변수를 선언하고, 어느 수퍼클래스로부터 상속을 받는지를 기입

헤더 파일인 *.h 파일에 정의

 

n         Implementation : 실지로 클래스를 정의하는 부분

구현 파일인 *.m에 구현

 

n         해더 파일과 구현부를 나누는 이유

외부에서 볼때 구현부를 독립해 접근 불가능

 

n         작성 요령

가능하면 1:1로 작성 이름을 통일

 

n         인터페이스 작성 예

@interface ClassName : ItsSuperClass

{

instance variables declaration..

}

method declarations

@end

 

n         메소드 선언시 옵션

-

Instance method

+

Class method

              메소드 선언시 인스턴스와 클래스메소드 같은 이름으로 생성 가능

              메소드 이름과 인스턴스 변수도 같은 이름으로 생성 가능

 

n         메소드 선언 예

-선언

- (void) setWidth: (float) width height: (float) height;

-사용

id *myRect = [[Rectangle alloc] init];

[myRect setWidth:12.2 height:18.0];

-가변적 변수수를 가진 메소드 선언

- makeGroup:group, …;

 

n         interface import

interface import C #include와 동일하나, import가 똑 같은 것을 한번만 가져오는 것만 inclue와 다름.

 

n         implementation 작성예

@implementation ClassName : ItsSuperclass -> superclass 생략 가능

{

    instance variable declarations -> 생략 가능

}

method definitions

@end

              간단히 쓰면,

#import "ClassName.h"

 @implementation ClassName

method definitions

@end

 

n         다른 클래스 참조

인터페이스에 선언되지 않은 클래스를 사용할 때

상호참조의 문제를 해결하기 위해 @class 지시자를 사용.

@class Rectangle, Circle;

이것은 단지 컴파일러에 이것이 클래스 이름이라는 것만 알려주는 역할

 

n         인터페이스 특징

인터페이스파일은 클래스의 참조현황을 파악하기 쉽게함

인스턴스 개체를 따로 관리함으로서 보다 직관적인 OOP를 가능하게 함

 

n         instance변수들의 사용범위를 설명한 지시자

@private

instance변수의 범위를 그것이 선언된 class 한정한다.(상속불가)

@protected

instance변수의 범위를 선언되고, 상속된 class 한정한다. (상속가능)

@public

instance변수의 범위에 대한 제한을 없앤다. (상속가능)

 

n         instance변수 범위 지정의 이유

슈퍼클래스 변수와의 독립성을 유지함으로서 보다 완벽한 오브젝트화 가능

 

n         다른 객체에 속한 인스턴스 변수사용 예

선언구현부

@interface Sibling : NSObject

{

Sibling *twin;

int gender;

struct features *appearance;

}

참조구현부

- makeIdentification

{

if( !twin)

{

twin = [[Sibling alloc] init];

twin->gender = gender;

twin->appearance = appearance;

}

return twin;

}

 

 

영문 레퍼런스트를 정리하다가 갑자기 생겨난 쓸데없는 오기..ㅡ.ㅡ
도움 되려나~ 


Posted by 김반장78
,

요즘 이거 읽느라 프로젝트가 전혀 진행이 안된다..ㅡ.ㅡ
문서원본은 애플꺼고 번역자 정보도 안에 들어있으니 저작권은 문제없지 싶다.
프로그램용어에 울렁증 있어서 한글인데도 읽다보면 정신이 혼미해진다..
Posted by 김반장78
,

編集部注:このゲスト寄稿の著者Alex Ahlundは、AppVeeAndroidAppsの元CEOであり、後者は最近モバイルアプリ・ディレクトリーのAppolicious買収された。同氏は現在Appoliciousのアドバイザーを務めている。

デベロッパーからも業界外からもよく聞かれる質問がある:アプリを開発するとどのくらい儲かるのか? 答えに窮する質問である。

そこでわれわれは調査を行った。99セントから$79.99セントまでのアプリケーションを販売するデベロッパー124社に、販売データを尋ねた。この調査で対象としたのは、大成功しているアプリからやっと3桁に乗るものまで、さまざまな人気度のアプリである。デベロッパーには、出資を受け自社で複数タイトルを出している企業から、新参の一人で開発している作者までいる。一般アプリのデベロッパーもゲームデベロッパーも含まれている。このデータマイニングは、iPhoneアプリ業界全体をカバーし、飛び抜けた例外によってデータが偏ることがないことを目的としている。

さまざまな条件を考慮に入れる必要がある。製品Xがよく売れたからといって製品Yもそうなるとは限らない。長年アプリのレビューを行ってきたパブリッシャーとして、私は統計の冷酷な実データを紹介することにいつも少し懸念をもっている。将来のiPhoneアプリの正確なモノサシとしては、統計データは大きな誤解の元である。このため、読者のみなさんには業界を概要する目的でこの情報を解釈していただきたい。他の業界と同じく、そこには勝ち組もいれば負け組もその中間もいる。

以下の財務情報は、詳細な販売データと価格形態を提供してくれた96社のデベロッパーのものだ。

平均売上本数は10万1024本で、平均販売期間は261日間。1日平均売上数は387。平均価格は$5.49、ただしこの値は$49.99という外れ値によって歪められている。平均アップデート発行数は3.89で、平均開発コストは$6453。何社かは開発コストを記入しておらず、多くは数値に人件費を含めていない。外注する場合にはこの数字の5倍から10倍と考える方が安全だろう。しかし、平均で見る限り、iPhoneデベロッパーはわずかな初期開発コストによって15倍以上の利益を得ていることになる。

市場での成功は未だに頭でっかち

しかしながら、成功したアプリの上位10%をデータから取り除くと、数値はずっと小さくなり、多くのデベロッパーにとってのiPhone業界をはるかによく表すようになる。このシナリオでは、平均販売数は1万1625本、平均44本/日である。約23%のアプリが公開以来1000本以下しか売れていない(App Store掲載期間12~370日間)。また、56%のアプリが1万本以下、90%が10万本以下で、残りの10%が売上12万7000~300万本を達成している。

業界の見識ではアプリケーションのアップデートは必ずダウンロードと販売数を増加させることになっているが、Appleがアップデートされたアプリの露出方法を変更したため、今は必ずしも正しくない。アップデートしてもダウンロード数にごく小さな山しか出来なかったと何社かのデベロッパーが報告している。売上にもっと大きく影響しているのは価格を下げることのようだが、これもまた長続きはしていない。

Appleに特集してもらうことが売上急増最大の貢献要因だ。Appleのプロモーションの威力は、予想どおりデベロッパーが経験する売上増に反映されている。「ニューリリースと注目作品」のコーナーは「スタッフのおすすめ」や「What’s Hot」に比べてやや効果が小さい。一般的にいって、特集されると2~20倍の売上増加が見込まれ、平均値に戻るまで1週間程度続くと考えてよさそうだ。ここでのポイントは、この急上昇を利用してアプリをトップリストに押し上げることにある ― 全体のトップ100でも、特定部門や国内のトップリストでもよい。一たびリストに載れば、そのアプリはさらに上位へと昇り、高水準の売上を維持できるチャンスが生まれる。

マーケティングの観点でも同じ戦術が使える。特集される可能性はどのアプリも同じではないが、短い期間を区切ってプロモーションを集中することが重要だ。長期にわたってマーケティングや広告を行うのではなく、短期間(できれば何日の単位)に集中することで、アプリがトップリスト入りするための効果がずっと高くなる。

それでは具体的なアプリケーションを見てみよう。正確な理解のためには各アプリをクリックして確認することをおすすめする。プロダクションバリュー、複雑さ、ニッチ、価格それぞれによって、すばらしい売上になるか微々たるものになるかが決まる。以下のリストは集めたデータの中で売上高の範囲に含まれる50種類のアプリケーションによる。

App Name Total Sales Days in Market App Price
Xpong 20 210 0.99
ShingleNav 28 156 4.99
Fumbers 62 40 1.99
Greenthumb! 87 231 1.99
FastTrac 199 60 4.99
splojit 217 238 0.99
Size Convert 354 210 0.99
Handbook of High-Risk Obstetrics 436 210 49.99
Traveler’s Quest 532 97 2.99
Cougar Call 800 229 0.99
Seasonalysis 1000 200 49.99
The Power of Now, by Eckhart Tolle 1179 223 13.99
Star Ride 1200 270 2.99
Star Fusion 1323 217 0.99
Germs 1465 102 0.99
iWasted 1500 201 0.99
Silly Songz 2000 365 0.99
School timetable 3648 395 0.99
Pi Cubed 3775 316 9.99
CardSnap 4690 342 14.99
Adaptunes 4754 272 0.99
Theme Park Madness 4788 367 2.99
Birthday Reminder 10000 250 1.99
Craigly 10000 400 0.99
EleMints 10224 505 4.99
Gridlocked: Traffic Control 12500 270 0.99
MeetMe. 15000 180 0.99
MicroCars 16613 230 1.99
Green Screen Studio 17025 210 2.99
NineGaps 18120 278 0.99
Distant Suns 20000 450 6.99
Numerology 34905 518 4.99
iEscaper! -Escape From the Ninja’s Lair- 35000 215 2.99
TapFormsDatabase 35100 517 8.99
A Doodle Flight 38000 225 0.99
Mini Touch Golf 40000 596 0.99
Art Envi 40000 580 0.99
Mover+ 46000 195 2.99
Orbital 50000 180 1.99
Scanner Pro 52514 143 6.99
Movie Challenge 53402 475 1.99
Formula Racing 127483 127 0.99
Stitch’em Words 200749 353 1.99
Air Hockey 300000 578 0.99
Finger Physics 418000 155 0.99
Fling! 500000 205 0.99
Moto X Mayhem 800000 218 0.99
PocketGuitar 1300000 530 0.99
Flight Control 2000000 361 0.99
Bejeweled 2 3000000 600 2.99

よく使われているマーケティング技法は、Facebook、フォーラム掲載、Twitter、自社ウェブサイト、プレスリリース、LikedIn、 アプリレビューサイト、ブログ、友人、コンテスト、YouTube、広告(印刷、クリック課金、バナー)、チラシ、ニューズレター、Flashデモ、実社会ネットワーク、ポッドキャスト等。どの手法も何らかの意味でデベロッパーを手助けしているが、アプリ製品の成功を真に左右するのはAppleとその選択の手にかかっている。他の業界で成功したアプリ(タイアップ)は、その関係によって膨大な利益を得ている。同じことは、既にウェブで知られているデベロッパーについても言える。

今のiPhoneアプリの市場は、ほんの数年先どうなるかを考えると、まだ初期段階にあると言ってよい。すでに20万を超えるアプリが公開されているが、これまでのペースをみると100万になるのも遠い先の話ではない。上記の売上分析は、現状の概要を理解する出発的になるはすだが、必ずしも個々のアプリの成否を表すものではない。週末に作って何百万ドルを稼いだアプリもあれば、何ヵ月もかかって事実上売上ゼロのものもある。デベロッパーはニッチを見つけてすばらしい幸運をつかもこともできるし、高いプロダクションバリューを持つ最高の製品を生み出すこともできる。結局は、後者の方が成功への安全な道のりだ。さあ、動き始める時だ。

Posted by 김반장78
,
강좌라기 보다는 내가 배우면서 찾아본 자료는 최신버전의 강좌가 없어서 
설정이나 메뉴구성이 미묘하게 다른 부분에 다른초보분들이 망설이지 않고 따라할수 있게..
이건 핑계고 걍 이런거라도 남기면서 하면 좀더 재미있을까 하는...

이번편의 목적은 윈도우 베이스의 어플에 뷰를 추가하는 과정을 해봄으로서 뷰나 기타 라이브러리의 추가에
익숙해지기 위해서 이다.

실행환경은 Xcode 3.2.4

순서는
1. 프로젝트 생성
2. 클래스파일 생성
3. 클래스파일 코딩
4. 인터페이스 빌더 작업
5. 완성

1. 프로젝트 생성
새프로젝트 생성에서 Window-based Application  선택

2. 클래스 파일 생성
생성하고자 하는 폴더 위에서 마우스 우클릭후 Add - New File.. 선택

UIViewController 를 선택

위에 클래스명을 적당히 적어주고 바로 밑의 Also Create 를 체크한다
언제나 그렇듯 명명은 중요하다 적당히 잘 적어넣자.
피니쉬 버튼을 누르면 3개의 파일이 생성된다.
그중 확장자가 xib인 화일은 이름을 다시 바꿔주는것도 좋을듯 하다. 혼동되기 쉽다.
그리고 폴더도 class 폴더보단 Resources 폴더가 더 어울리는 것같다. 옮겨주자.

3. 소스 수정
Project명이 Test라면 프로젝트 생성시에 TestAppDelegate.h TestAppDelegate.m 파일이 생성되었을것이다.

TestAppDelegate.h  

------------------------------------------------------------------

#import <UIKit/UIKit.h>

@class WelcomeCtr;


@interface TestAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;

    WelcomeCtr *welcomeCtr; //추가

}


@property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet WelcomeCtr *welcomeCtr;  //추가


@end


------------------------------------------------------------------


TestAppDelegate.m


------------------------------------------------------------------


#import "TestAppDelegate.h"

#import "WelcomeCtr.h"


@implementation TestAppDelegate


@synthesize window;

@synthesize welcomeCtr;   //추가


#pragma mark -

#pragma mark Application lifecycle


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    

    // Override point for customization after application launch.

[window addSubview:welcomeCtr.view];   //추가

    [window makeKeyAndVisible];

    

    return YES;

}



- (void)applicationWillResignActive:(UIApplication *)application {

    /*

     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

     */

}



- (void)applicationDidEnterBackground:(UIApplication *)application {

    /*

     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 

     If your application supports background execution, called instead of applicationWillTerminate: when the user quits.

     */

}



- (void)applicationWillEnterForeground:(UIApplication *)application {

    /*

     Called as part of  transition from the background to the inactive state: here you can undo many of the changes made on entering the background.

     */

}



- (void)applicationDidBecomeActive:(UIApplication *)application {

    /*

     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

     */

}



- (void)applicationWillTerminate:(UIApplication *)application {

    /*

     Called when the application is about to terminate.

     See also applicationDidEnterBackground:.

     */

}



#pragma mark -

#pragma mark Memory management


- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {

    /*

     Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.

     */

}



- (void)dealloc {

[welcomeCtr release];   //추가

    [window release];

    [super dealloc];

}



@end


------------------------------------------------------------------


4. 인터페이스 빌더 작업

Overview창에서 MainWindow.xib 파일을 더블클릭하면 인터페이스 빌더가 실행된다
라이브러리창에서 View Controller 를 끌어다가 MainWindow.xib창에다 놓는다.
라이브러리창이 보이지 않는다면 인터페이스 빌더 상단 메뉴에서 View - Library를 선택한다.
이작업은 생성한 뷰객체를 넣을수 있는 공간을 마련한다고 생각하면 될듯하다.


생성된 View Controller 객체를 클릭후 상단의 파란색 Inspector 버튼을 클릭하면 오른쪽의 어트리뷰트창이 열린다.
첫번째 탭을 선택후 NIB Name 을 생성한 xib 파일명으로 선택해준다


마지막 탭을 선택후 Class에 자신이 생성한 클래스 파일을 선택해준다.

마지막 작업이다.
스샷에는 Finder App Delegate 라고 되있지만 자신의 프로젝트명 App Delegate 를 선택하고 마우스 우클릭을 하면
밑에 보이는 검은색 팝업이 열린다.
welcomeCtr 옆의 속이 비어있는 원을 클릭후 오른쪽의 Welcome Ctr 에다가 끌어다 놓는다.


잘 되었다면 아래의 화면처럼 되었을 것이다.


이걸로 끝이다 
별내용 아닌데 길어졌다.

아이폰에서 실행시켜보면 새하얀 화면이 나오는것을 확인할수 있다.
이작업이 귀찮다면 가장위의 화면에서 View-base 앱을 선택해주면 지금까지의 작업이 완료된 프로젝트가 생성된다. 
먼짓한거야...
Posted by 김반장78
,
구글링을 통해 찾아냈다.
거의 예전 버전밖에 없어서 고생..

실행기반은 Xcode 3.2.4 iPhone 4.1

인증서 만들기

  1. Open up Keychain Access in Applications>Utilities.
  2. Go to Keychain Access>Certificate Assistant>Create a Certificate.
  3. For ‘Name’, type: iPhone Pwned Developer
  4. For ‘Identity Type’, leave it as ‘Self Signed Root’.
  5. For ‘Certificate Type’, choose ‘Code Signing’.
  6. Check the box for ‘Let me override defaults’.
  7. Click on Continue, and in the popup box that comes up.
  8. Type in any number under ‘Serial Number’.
  9. Leave ‘Validity Period (days)’ alone.
  10. Click on Continue.
  11. Fill in the details with whatever you want (not really necessary).
  12. Click on Continue.
  13. Click on Continue for the rest of the dialog boxes.

Xcode 설정

  1. Open /Developer/Platforms/iPhoneOS.platform/Info.plist with Property List Editor.
  2. Look for all ‘XCiPhoneOSCodeSignContext’ VALUES. Replace that with ‘XCCodeSignContext’. There should be two or three to replace.
  3. Save the file.
  4. Restart Xcode, and build your app for a device.

Open up your project settings in Xcode (Project>Edit Project Settings), go to the Build tab, and under ‘Code Signing’, extend ‘Code Signing Identity’, and choose ‘iPhone Pwned Developer’, which should be the name of the certificate you just made above.

스샷은 필요없지 싶다.
버전하나 올라갈때마다 화면이 바껴서 크게 소용없을듯..

Posted by 김반장78
,

#import "AddCityController.h"

#import "CityGuideDelegate.h"

#import "RootController.h"

#import "City.h";


@implementation AddCityController


#pragma mark ViewController Methods


- (void)didReceiveMemoryWarning {

// Releases the view if it doesn't have a superview.

    [super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.

}


- (void)viewDidLoad {

self.title = @"New City";

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveCity:)];

cityPicture = [UIImage imageNamed:@"QuestionMark.jpg"];

pickerController = [[UIImagePickerController alloc] init];

pickerController.allowsEditing = NO;

pickerController.delegate = self;

pickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;


}


- (void)viewDidUnload {

// Release any retained subviews of the main view.

// e.g. self.myOutlet = nil;

}



- (void)dealloc {

[tableView release];

[nameCell release];

[pictureCell release];

[descriptionCell release];

[pickerController release];

    [super dealloc];

}


#pragma mark Instance Methods

- (void)saveCity:(id)sender {

CityGuideDelegate *delegate = (CityGuideDelegate *)[[UIApplication sharedApplication] delegate];

NSMutableArray *cities = delegate.cities;

UITextField *nameEntry = (UITextField *)[nameCell viewWithTag:777];

UITextView *descriptionEntry = (UITextView *)[descriptionCell viewWithTag:777];

if ( nameEntry.text.length > 0 ) {

City *newCity = [[City alloc] init];

newCity.cityName = nameEntry.text;

newCity.cityDescription = descriptionEntry.text;

newCity.cityPicture = cityPicture;

[cities addObject:newCity];

RootController *viewController = delegate.viewController;

[viewController.tableView reloadData];

}

[delegate.navController popViewControllerAnimated:YES];

}


- (IBAction)addPicture:(id)sender {

UITextField *nameEntry = (UITextField *)[nameCell viewWithTag:777];

[nameEntry resignFirstResponder];

[self presentModalViewController:pickerController animated:YES];

}


#pragma mark UIImagePickerController Methods


- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

[self dismissModalViewControllerAnimated:YES];


cityPicture = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

UIImageView *pictureView = (UIImageView *)[pictureCell viewWithTag:777];

pictureView.image = cityPicture;

[tableView reloadData];

}


#pragma mark UITableViewDataSource Methods


- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewCell *cell = nil;

if( indexPath.row == 0 ) {

cell = nameCell;

} else if ( indexPath.row == 1 ) {

UIImageView *pictureView = (UIImageView *)[pictureCell viewWithTag:777];

pictureView.image = cityPicture;

cell = pictureCell;

} else {

cell = descriptionCell;

}

return cell;

}


- (NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section {

return 3;

}


#pragma mark UITableViewDelegate Methods


- (CGFloat)tableView:(UITableView *)tv heightForRowAtIndexPath:(NSIndexPath *)indexPath {

CGFloat height;

if( indexPath.row == 0 ) {

height = 44;

} else if( indexPath.row == 1 ) {

height = 83;

} else {

height = 279;

}

return height;

}


@end


Posted by 김반장78
,

위 사진처럼 시뮬레이터 버전 수정해 주면 된다.

맥에서는 티스토리 사진 안올라가 지더니 갑자기 되네 고친건가..,
조금더 편하게 블로깅 할수 있을듯 ㅋ
Posted by 김반장78
,

한국에서 책이 도착했다

조금 읽어 봤는데 연습하면서 느낀점이 바로 나오더라는..
책은 잘산거 같다
일년에 한두권 사는 책이 참고서 아니면 학습서이니..ㅡ.ㅡ
Posted by 김반장78
,