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
56 Core Audio를 사용하여 macOS에서 Audio를 Capture하는 코드 digipine 2024.04.19 8
55 macOS Daemon 관련 시스템 폴더 목록 lizard2019 2024.03.08 28
54 Firebase 'GoogleUtilities/GULURLSessionDataResponse.h' file not found Error Fix lizard2019 2023.07.04 220
53 [macOS] Xcode 디버깅 시 Could not attach pid 오류 해결 file lizard2019 2023.06.05 591
52 [macOS, iOS] 개발자 정보 확인하는 명령어 digipine 2023.03.23 167
51 [macOS] 현재 사용 중인(열려있는) 포트 확인하고 Close 하기 digipine 2022.10.24 270
50 [iOS] Audio Session Setting digipine 2021.11.26 548
49 [iOS] 개발자를 위한 iOS 15의 새로운 기능 file digipine 2021.11.04 498
48 [iOS/macOS] 사설 인증서를 사용한 SSL HTTPS 통신 시 우회처리 digipine 2021.07.06 2993
47 [MacOS] Terminal 에서 zsh compinit: insecure directories 경고 제거하기 lizard2019 2021.04.30 565
46 Concurrent vs Serial DispatchQueue: Concurrency in Swift explained lizard2019 2021.04.16 417
45 WatermelonDB 'jsi/jsi.h' file not found 문제 해결 file digipine 2021.04.06 733
44 [iOS/Objective-C] __weak, __block 사용법 digipine 2021.02.16 5558
43 macOS ARP Spoofing Attack file digipine 2020.09.17 694
42 The distance estimate iBeacon signal strength lizard2019 2019.10.25 695
41 [MacOS, Swift] 스크롤뷰, NSScrollView 사용법 엉뚱도마뱀 2018.11.01 1264
40 [swfit 4] 스위프트 Swift 동시성 동기화 정리 엉뚱도마뱀 2018.09.06 1316
39 [swift 4] 변경 사항 정리 file 엉뚱도마뱀 2018.07.23 1020
38 [Objective-C] NSOperation과 NSOperationQueue를 사용하는 방법 - 설명 및 예제 엉뚱도마뱀 2018.03.14 4195
37 MacOS mysql 비밀번호 분실 시 재설정하기 digipine 2017.11.14 1029
Board Pagination Prev 1 2 3 Next
/ 3