iPhone Programming for Dummy - 3
2.4. Hello, iPhone재미있게 시뮬레이터를 가지고 놀았는가? 그러면 apple+Q 키를 눌러서 시뮬레이터를 종료하고 다시 Xcode 의 Workspace 개발 환경으로 돌아오자.
현재 우리가 컴파일하고 실행한 프로그램은 가장 기본적인 템플릿만 포함되어 있을 뿐이고, 아무런 작업도 하지 않았기 때문에 실행해도 빈 공간만 나타날 뿐 아무것도 볼 수 없었다.
프
로그래밍 언어를 공부하면 항상 처음 등장하게 되는 "Hello... 프로그램" 을 여기서도 작성해 볼 참이다. 일단 뭔가 눈에
보이게 동작하는 프로그램을 하나 작성한다는 것은 기분 좋은 일이고, 또한 프로그래밍을 설명하는 과정에서 시작 단계로 거쳐야 하는
하나의 전통을 지켜야 한다는 기분도 드는 것이 사실이다.
물론, 간단하게 하자. 만들고자 하는 것은 화면에 'Hello, iPhone' 이라는 한 줄의 텍스트를 보여주는 프로그램을 작성하려는 것이다.
Workspace
에서 ***Delegate.m 같은 소스 파일을 선택하면 에디터 창에서 자동으로 생성되어 있는 소스 코드를 살펴볼 수 있다.
우리가 지금 하려는 작업도 이런 소스코드에 코드를 추가하여 할 수도 있지만, Interface Builder 를 사용해서 같은
결과를 얻을 수 있다면 IB를 사용하는 것을 기본으로 할 것이다.
Interface Builder 를 실행하기 위해, 먼저 Workspace 의 왼쪽 단에 있는 그룹들을 살펴보자. 가장 아래 부분에 아래 그림과 같은
XIB 파일들이 등록되어 있는 것을 확인할 수 있다. 현재 우리가 선택한 템플릿은 기본적으로 두 개의 XIB 파일이 생성되어 있다.
XIB
파일은 OS X Interface Builder 의 약자라고 생각하면 된다. .xib 확장자는 최근부터 사용하기 시작한
것으로서, 원래는 예전부터 NIB 라는 이름으로 확장자 역시 .nib 를 사용했다. NIB 는 NeXTStep Interface
Builder 의 약자이다. XIB 라는 이름을 사용하게 된 것은 그리 얼마되지 않았기 때문에, 아직 많은 문서들은 nib 라는
이름을 사용하고 있다. 이 점을 참고바란다.
템플릿이 기본으로 가지고 있던 두 개의 XIB 파일은 MainWindow.xib 와 <프로젝트>ViewController.xib 파일이다.
다시 짚어보자. Interface Builder 는 말 그대로 사용자 인터페이스를 쉽게 구성하는 도구다. 따라서, 프로젝트에 포함되어 있는 xib 파일은 각각 어떤 종류의 사용자 인터페이스를 의미한다.
여기서 MainWindow.xib 는 모든 Application 이 기본적으로 가지게 되는 가장 기본적인 xib 파일로서, 최소한 이것 하나는 가지고 있게 된다. 이것은 응용 프로그램이 사용할
Window 라는 것을 구성하고 있으며, 모든 응용 프로그램들은 하나의 Window 를 가진다.
그리고, 또 하나의 XIB 파일이 보인다. 이것은
View
의 XIB 파일이다. View 는 iPhone SDK 에서 UI 를 구성하는 가장 바탕이 되는 도화지 같은 것으로서, 각종
버튼과 입력 상자, 목록 등은 모두 View 위에서 구성한다고 생각하면 된다. View 에 대해서는 나중에 좀 더 살펴보도록
하자.
<프로젝트이름>ViewController.xib 라는 식으로
이름지어진 XIB 파일을 더블 클릭하면, 해당 파일을 가지고서 Interface Builder 프로그램이 별도로 실행된다. 이제
Xcode 와 Interface Builder 가 함께 실행되고 있는 상태가 된 것이다.
Interface Builder 가 실행되면, 다수의 창이 열린다. 그 중에서 아래 그림과 같은 창이 Interface Builder 의 가장 기본이 되는 창이라고 할 수 있다. 아래 그림처럼 3개의 아이콘이 있을 것이다.
File's Owner 아이콘은 현재 Xcode 에서 작성중인 응용 프로그램 자체의 인스턴스(instance)를 의미한다. 이 말이 무슨소린지 애매해도 일단은 그냥 넘어가보자.
First Responder 아이콘은 본 문서에서는 다루지 않는 범위에 있으므로, 나중에 필요하다면 다른 자료를 참고하기 바란다.
View 아이콘은 현재 XIB 에서 구성하며, 눈에 보이는 view 인스턴스를 의미한다.
이게 다 뭔지, 이걸 어디에 사용하는지는 생각하지 말고, 다시 화면에 나타난 다른 창을 둘러보도록 하자.
다음 그림과 같은 View 창이 보인다. 이것은 현재 View 의 눈에 보이는 형상을 나타내는 것으로서, 바꿔 말하자면 하얀 도화지가 한장 준비되어 있는 셈이다. 실제 눈으로 보이는 부분들은 이곳에서 작업할 수 있다.
그리고 두 개의 작업 도구 창이 기본적으로 보이게 되어 있다.
그중 하나는 속성 도구 창으로서, 바로 앞에서 말한 View 창에서 선택된 객체의 각종 속성을 보여주고, 설정할 수 있는 창이다. 여기에는 네 개의 탭이 있다.
그
리고 마지막으로, 가장 눈에 띄이는 라이브러리 선택 창이 있다. 보는 것 만으로도 대충 어떤 것인지 알 수 있다. iPhone
의 User Interface 를 구성하는 각종 모든 객체들을 선택할 수 있으며, View 에 드래그 앤 드롭 하여 눈으로
확인하면서 작업할 수 있다.
Interface Builder 의 여러 가지 설정법과 사용법은 여러 예제를 다루면서 차차 익혀나가도 되며, Interface Builder User Guide 같은 문서를 살펴보면서 보다 상세한 내용을 살펴보아도 좋다.
일
단, 여기서는 처음 목적대로 'Hello, iPhone' 프로그램을 빨리 작성해 보자. 라이브러리 창을 보면 아래 그림처럼
Label 아이템이 있다. Apple 문서에서는 'View Item' 이라고 말하기도 하고, 그냥 'UI Element' 라고
부르기도 한다.
어찌되었건, 이것을 마우스로 '끌어다가' View 창 위의 임의의 위치에 '떨어뜨린다'.
이미 여러분들은 그 정도는 눈치채셨겠지만, Label item 은 단순히 문자열을 화면에 표시하기 위해 사용하는 UI 객체이다.
아래 그림처럼 이 라벨의 내용을 'Hello, iPhone' 으로 변경해보자. 텍스트 변경은 View 창에서 직접 할 수도 있고, 속성 설정 창에서 Text 필드를 변경해서 할 수도 있다.
속
성 창에서 여러 가지 속성들을 조정하면 어떻게 반영되는지 시험해 보도록 하자. 세 번째 탭에서 Label item 의 위치에
관한 설정을 조절해 볼 수도 있고 - 여기서 맨 아래 버튼을 사용하면 쉽게 가운데 정렬을 맞출 수 있다 - 첫 번째 탭에서
기본적인 여러 가지 형태에 관한 설정을 변경해 볼 수도 있다.
여러가지 시험해 볼 사항이 많지만, 일단 여기서 멈추고 마무리 작업으로 진행하자.
우리의 목적한 바는 이미 Interface Builder 에서 작업이 끝났다. (덧붙이자면, 이렇게 작업한 View 를 Window 위에 올려놓는 작업도 이미 기본 템플릿에 의해 완성되어 있다)
Interface Builder 에서의 작업이 끝났으므로, apple+S 키를 눌러서 XIB 파일을 저장하고, 다시 Xcode 로 돌아간다. Interface Builder 를 종료할 필요는 없다.
현재 Xcode 의 Workspace 에는 변경된 것이 아무것도 없다. 그러나 프로젝트에 포함되어 있는 XIB 파일 하나가 방금 Interface Builder 에 의해 변경되어 있는 상태다.
다시 Build & Run 버튼을 눌러서, 컴파일 하고 에뮬레이터가 실행되는 것을 지켜보자. 그러면 새로 작업한 XIB 파일의 내용이 반영되어 새로 수정된 응용 프로그램을 확인할 수 있을 것이다.
어떤가? Interface Builder 의 힘을 빌려서 코드 한 줄 작성하지 않았지만, 그래도 Hello 프로그램 작성은 잘 끝났다. 첫 번째 iPhone 응용 프로그램을 완성한 셈이다.
만일 우리가 실제 iPhone 이나 iPod Touch 를 가지고 있고, 다운로드 할 수 있는 Key 를 가지고 있다면 실제로 단말기에 다운로드 한 후 실행해서 눈으로 확인하는 것도 가능하다.
항상 그렇지만, Hello 프로그램들은 너무 단순해서 완성해도 약간 아쉬움이 남는다. 더우기 지금처럼 RAD Tool 을 사용하는 경우라면, 실제로 작업한 것이 아무것도 없다는 느낌이 든다.
그러므로, 이제 실제로 뭔가 동작하는 Hello 프로그램을 작성해 보자. 이것은 보다 iPhone SDK 프로그래밍의 실질적인
내용을 다루게 될 것이다. 그리고 좀 더 프로그래밍에 필요한 개념적인 내용들을 살펴보도록 하자. 두 번째로 작성할 프로그램은
Apple 의
iPhone Application Tutorial 문서를 기본으로 하고 있다.
재미있는 부분은 지금부터다.
출처 : http://www.iphoneos.co.kr/zbxe/147
Louis Vuitton and Marc Jacobs first cooperation has already been 15 years of time,Cheap Gucci although not for the world at the beginning of the cooperation,Cheap Gucci Shoes in view of the cooperation between think they won't last long. Louis Vuitton brand because this is traditional,Louis vuitton store and designer at that time and Jacobs is very young and very funny. However the cooperation between them is like a love anecdotes, let the other parties in the 15 years of the time it becomes more and more powerful and strong.cheap gucci shoes Now, the pair, a full of France's taste and respect for the world, and the other one is still active as before.Cheap Gucci Clothing Now New York designer Marc Jacobs be born is in Paris is Musee des Arts Decoratifs an exhibition at the museum of the Louis Vuitton-Marc Jacobs "exhibition protagonist.Cheap Gucci Shoes Seriously, the two men look doesn't seem to be any common ground, one is the expression serious gentleman Vuitton (at least from the entrance of the museum's portrait of the look the way it does),cheap louis vuitton and the other is wearing a short skirt of Scotland rebellious guy. However, the founder of the brand or a real genius,Cheap Gucci Handbag successfully hold the 19 th century people is fond of sport and innovation hobby, making a suitable for early car the trunk and place the luggage into camping use of folding bed.Prada Handbag Jacobs stylist to the same brand compelling creativity, hoping to break all the rules bound,cheap louis vuitton shoes as the brand's first and only ready-to-wear designers,Cheap Gucci backpack he wants to design costumes and deserve to have an amazing vigor. As in 1896, the designer Louis Vuitton Georges,Armani Clothing Wholesale the son of the brand Logo design with the whole box print the shell, no one can predict to the move to the impact of the brand.cheap prada shoes Who will think of stylist Jacobs will this classic Speedy handbag designer Takashi Murakami series let Japan above picture with big round eyes,Cheap Gucci Belt or let Stephen Sprouse above master graffiti colored the graffiti letters? Founder Louis Vuitton and he created the world in this exhibition hall on the first floor,cheap jordan sneakers suitable for simple travel series small handbag on display in different one display the;New Arrive Shoes Another display shows the used to hold various delicate clothing suitcase-tea party dress, morning gown; Dinner dress and PROM gowns; Countless levels of underwear and enormous bustle,Jordan Shoes then the s women a day seven times of change clothes golden age. But Debbie Harry song soon put you attracted to the second floor of the exhibition hall,Nike Shoes there is a huge handled the screen (curator Pamela Golbin make it a slight bo page form), used to highlight the free spirit of Jacobs advocate the effects of Bertolucci-and movie "South Park" mix together,Winter Clothing "Cat on a Hot Tin Roof" next to SpongeBob SpongeBob, SpongeBob SpongeBob next to German director Rainer Fassbinder's gay film genius "Querelle".Mens Shoes The exhibition is more like a celebration not simple works retrospective exhibition in accordance with the time not the sequence of the display,Mens T Shirts but the exhibition are divided into different subjects on. Jacobs to give each a different theme plays a very attractive name,Adidas Men Shoes each subject inside of the exhibits in the past 15 years is the representative work of carefully selected fashion. Shoes with mechanical legs to the show,Men Suits &Ties they have a dance Busby Berkeley that precise master pace. Artist Richard Prince of five nurses the human body model hat spell "L-O-U-I-S V-U-I-T-T-O-N",Mens Long Sleeve at the same time in the background is continuously came 1963 Kingsmen of famous chorus works: "Louie Louie,......" . The museum these trunks called it "chocolate box",Mens Sweater may produce more attractive for the audience. The display of trunk is like a great little French candy,Mens Jeans whether it is full of LV logo printing white ermine equipment packet to the purple pattern of the large truck suitcase, are displayed to the full and explore the LV brand connotation.Mens Jackets Whether jeans, metallic fabrics, or the woven plastic fabrics, handbag to send out the strong temptation, Louis Vuitton is this may never dream of. http://ixcoin.org/forum/index.php?topic=15359.0 http://ixcoin.org/forum/index.php?topic=15358.0 http://ixcoin.org/forum/index.php?topic=15360.0 http://ixcoin.org/forum/index.php?topic=15361.0 http://ixcoin.org/forum/index.php?topic=15362.0 http://ixcoin.org/forum/index.php?topic=15363.0 http://ixcoin.org/forum/index.php?topic=15364.0 http://ixcoin.org/forum/index.php?topic=15365.0 http://ixcoin.org/forum/index.php?topic=15366.0 http://ixcoin.org/forum/index.php?action=profile;area=summary;u=8275 http://secureink.net/forum/index.php?topic=21678.0 http://secureink.net/forum/index.php?topic=21679.0 http://secureink.net/forum/index.php?topic=21680.0 http://secureink.net/forum/index.php?topic=21681.0 http://secureink.net/forum/index.php?topic=21682.0 http://secureink.net/forum/index.php?topic=21684.0 http://secureink.net/forum/index.php?topic=21685.0 http://secureink.net/forum/index.php?topic=21686.0 http://secureink.net/forum/index.php?topic=21687.0 http://secureink.net/forum/index.php?action=profile;area=summary;u=12091 http://enjoykalkan.com/forum/index.php?topic=9145.0 http://enjoykalkan.com/forum/index.php?topic=9146.0 http://enjoykalkan.com/forum/index.php?topic=9147.0 http://enjoykalkan.com/forum/index.php?topic=9148.0 http://enjoykalkan.com/forum/index.php?topic=9149.0 http://enjoykalkan.com/forum/index.php?topic=9150.0 http://enjoykalkan.com/forum/index.php?topic=9151.0 http://enjoykalkan.com/forum/index.php?topic=9152.0 http://enjoykalkan.com/forum/index.php?topic=9153.0 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4797#4797 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4798#4798 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4799#4799 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4800#4800 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4801#4801 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4802#4802 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4803#4803 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4804#4804 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=view&catid=2&id=4805#4805 http://www.cubasi.net/index.php?option=com_fireboard&Itemid=54&func=myprofile&do=show http://www.ipacific.com/forum/index.php?topic=940.0 http://www.ipacific.com/forum/index.php?topic=941.0 http://www.ipacific.com/forum/index.php?topic=942.0 http://www.ipacific.com/forum/index.php?topic=943.0 http://www.ipacific.com/forum/index.php?topic=944.0 http://www.ipacific.com/forum/index.php?topic=946.0 http://www.ipacific.com/forum/index.php?topic=947.0 http://www.ipacific.com/forum/index.php?topic=948.0 http://www.ipacific.com/forum/index.php?topic=949.0 http://www.ipacific.com/forum/index.php?action=profile;area=summary;u=2367 http://raptisoft.com/forum/index.php?topic=3242.0 http://raptisoft.com/forum/index.php?topic=3243.0 http://raptisoft.com/forum/index.php?topic=3244.0 http://raptisoft.com/forum/index.php?topic=3245.0 http://raptisoft.com/forum/index.php?topic=3246.0 http://raptisoft.com/forum/index.php?topic=3247.0 http://raptisoft.com/forum/index.php?topic=3248.0 http://raptisoft.com/forum/index.php?topic=3249.0 http://raptisoft.com/forum/index.php?topic=3250.0 http://raptisoft.com/forum/index.php?action=profile;area=summary;u=7289 http://sober4life.org/forum/index.php?topic=113874.0 http://sober4life.org/forum/index.php?topic=113876.0 http://sober4life.org/forum/index.php?topic=113877.0 http://sober4life.org/forum/index.php?topic=113878.0 http://sober4life.org/forum/index.php?topic=113879.0 http://sober4life.org/forum/index.php?topic=113880.0 http://sober4life.org/forum/index.php?topic=113881.0 http://sober4life.org/forum/index.php?topic=113882.0 http://sober4life.org/forum/index.php?topic=113883.0 http://sober4life.org/forum/index.php?action=profile;u=127684