Kiosk

Android/iOS Application

Web Application

Spring Framework

Windows Application

    

앱개발지침


 
작성일 : 11-11-11 17:30
viewDidLoad 와 viewWillAppear의 차이
 글쓴이 : 관리자
조회 : 11,596  
이 두개의 차이를 처음에는 잘 모르죠.

아래 자세한 영문 설명이 있습니다. (윽 돌 날라온다 ...)

한글로 설명을 하자면....

view는 한개의 object죠.

viewDidLoad는 view object가 생성된 후 발생하는 이벤트입니다. 메모리에 view가 올라온 다음이라는 것입니다.

그리고 viewWillAppear는 view가 안보이다가 다시 보이게 되었을때 발생하는 이벤트입니다.

뷰가 A => B => C 이렇게 네비게이션이 발생할때

처음에 A => B => C 갈때는 viewDidLoad와 viewWillAppear가 모두 발생합니다.
C => B => A로 돌아올때는 viewWillAppear만 발생하는 것입니다.
그다음에 A=>B=>C로 갈때도 viewWillAppear만 발생하는 것입니다.

생성시점과 보여주는 시점을 분리한 것입니다.



1) ViewDidLoad - Whenever I'm adding controls to a view that should appear together with the view, right away, I put it in the ViewDidLoad method. Basically this method is called whenever the view was loaded into memory. So for example, if my view is a form with 3 labels, I would add the labels here; the view will never exist without those forms.

2) ViewWillAppear: I use ViewWillAppear usually just to update the data on the form. So, for the example above, I would use this to actually load the data from my domain into the form. Creation of UIViews is fairly expensive, and you should avoid as much as possible doing that on the ViewWillAppear method, becuase when this gets called, it means that the iPhone is already ready to show the UIView to the user, and anything heavy you do here will impact performance in a very visible manner (like animations being delayed, etc).

3) ViewDidAppear: Finally, I use the ViewDidAppear to start off new threads to things that would take a long time to execute, like for example doing a webservice call to get extra data for the form above.The good thing is that because the view already exists and is being displayed to the user, you can show a nice "Waiting" message to the user while you get the data.

 
 

Total 31
번호 제   목 글쓴이 날짜 조회
40 [android개발] Event-Driven 관리자 04-15 2378
39 [android개발] Activity, Service, Receiver 관리자 04-15 2233
38 [android개발] Object & Class 관리자 04-15 1979
37 우편번호 검색 URL 관리자 10-25 2392
36 아이폰 어플디자인 가이드라인 관리자 07-05 6730
35 어플제작비용 관리자 04-30 5646
34 android의 viewDidLoad와 viewWillAppear는 ? 관리자 11-11 2934
24 viewDidLoad 와 viewWillAppear의 차이 관리자 11-11 11597
32 앱기능 구성 관리자 10-31 3023
31 앱개발 견적산출 방법 관리자 10-31 7809
30 스토리보드샘플(쇼핑몰) 관리자 06-21 7723
29 쇼핑몰 UI설계서 관리자 04-30 5791
27 JSON 인터페이스 관리자 04-30 5242
26 Appstore 리뷰 가이드라인(한글버전) 관리자 04-02 3937
25 메모리 관리(문씨 강좌) 관리자 04-02 8355
24 아이폰 개발은 쉽다 ? 관리자 04-02 4152
23 앱 ? 웹 ? 관리자 04-02 3362
22 둥근 모서리 만들기 관리자 03-09 3664
21 뷰컨트롤러간의 변수및 메소드 공유 관리자 03-09 6473
20 번들ID 간편하게 관리하기( Provisioning > XCode > AppStore ) 관리자 03-09 39395
 1  2  
서비스이용약관  |  개인정보취급방침  | 이메일 무단수집거부 Email:modeller@naver.com | Copyright(C) GYnet Co.