logo

English

이곳의 프로그래밍관련 정보와 소스는 마음대로 활용하셔도 좋습니다. 다만 쓰시기 전에 통보 정도는 해주시는 것이 예의 일것 같습니다. 질문이나 오류 수정은 siseong@gmail.com 으로 주세요. 감사합니다.

iOS - View 이동 전환 하기 총정리

by digipine posted Nov 01, 2017
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
뷰의 추가 또는 삽입  
[self.view insertSubview:viewController.view atIndex:0];
 
[self.view addSubview:viewController.view]; 
 
[self presentModalViewController:viewController animated:YES];  --> 앤 모달뷰
 
[self.navigationController pushViewController:addView animated:YES]; 
 
뷰의 순서 바꾸기
[self.view bringSubviewToFront:self.tempViewController.view]; 
-> tempViewController.view를 가장 앞으로 이동한다. 
 
[self.view sendSubviewToFront:self.tempViewController.view]; 
-> tempViewController.view를 가장 뒤로 이동한다. 
 
[self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:2]; 
-> 0번 뷰와 2번뷰의 위치를 바꾼다 
   위에서 insertSubView .... atIndex로 뷰의 번호를 지정하면 view가 쌓인다 
   이 순서를 변경할수 있다. 
   주위 해야 할것은 Atindex:number로 뷰를 넣을 경우 해당 뷰가 number로 계속
   지정 되는 것이 아니라 이동후에는 각각의 위치 번호로 된다. 
예) 
[self.view insertSubview:oneController.view atIndex:0];
[self.view insertSubview:twoController.view atIndex:2];
[self.view insertSubview:threeController.view atIndex:2];
--> 이때는 onController.view가      0     
          twoController.view가     1  
          threeController.view가   2   이다. 
여기서 
[self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:2];  하면
onController.view가      2     
twoController.view가     1  
threeController.view가   0  이 된다. 즉 할당된 번호가 계속 따라 다니는 것이 아니라 
최최 지정 할때만 적용 되며 변경 후에는 뷰스택(?)에 샇인 번호로 바뀐다. 
이거 몰라서 3일 버렸다 왜 원하는 대로 안나올까 하고.... 바보 같이.. 
--> 아직까지는 그렇게 알고 있다. 나두 아이폰 관련 개발 공부 한지 인자 몇일 안되서 
    틀린 정보 일수도 있다. 
 
뷰 스택 로그 찍기 
NSLog([[self.view subviews] description]); 
-> 뷰가 쌓여 있는 스택(?) 순서를 콘솔로 볼수 있다.  
   로그를 볼때는 view에 tag로 번호를 지정한다음에 보면 콘솔에 해당 tag가 나와서 
   한결 보기 편하다. 
 
뷰 addSubview:뷰
 
뷰 inserSubview뷰 atIndex:번호
 
컨트롤러 pushViewController:컨트롤러 애니옵션
 
컨트롤러 presentModalViewController:컨트롤러 애니옵션
TAG •

List of Articles
No. Subject Author Date Views
36 iOS - Socket Nagle 알고리듬 OFF digipine 2017.11.01 208
35 iOS - Thread Loop 내에서 UI 업데이트 방법 digipine 2017.11.01 211
34 iOS - UILabel 에서 AttributeString 사용하기 digipine 2017.11.02 640
33 iOS - UITextField의 Placeholder Color 색 변경하기 file digipine 2017.11.02 1152
» iOS - View 이동 전환 하기 총정리 digipine 2017.11.01 537
31 iOS - 코드 수행시간 측정하기 - getTickCount digipine 2017.11.01 848
30 iOS,OSX - CFSocket 사용법 digipine 2017.11.01 444
29 macOS ARP Spoofing Attack file digipine 2020.09.17 694
28 macOS Daemon 관련 시스템 폴더 목록 lizard2019 2024.03.08 28
27 MacOS mysql 비밀번호 분실 시 재설정하기 digipine 2017.11.14 1029
26 OpenAL PDF, Sample Source file digipine 2017.11.02 796
25 OSX - Screen Serial Terminal - OSX에서 시리얼 터미널 사용하기 digipine 2017.11.03 6871
24 OSX 사파리 최신 버전 폰트 변경하기 file digipine 2017.11.03 1224
23 The distance estimate iBeacon signal strength lizard2019 2019.10.25 695
22 WatermelonDB 'jsi/jsi.h' file not found 문제 해결 file digipine 2021.04.06 733
21 XCode 8 업데이트 후 Code Sign Error 발생 시 해결법 1 digipine 2017.11.02 711
20 [iOS, MacOS] ATS 보안 정책 가이드 digipine 2017.11.02 570
19 [iOS, MacOS] NSArray 정렬 Sorting에 대해서 digipine 2017.11.02 667
18 [iOS, MacOS] NSNotification, NSNotificationCenter 사용법 digipine 2017.11.02 1026
17 [iOS, MacOS] Singleton 싱글톤 패턴 사용하기 2 digipine 2017.11.02 1080
Board Pagination Prev 1 2 3 Next
/ 3