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
57 Apple AppStore App Review 시 Reject 피하기 위한 방법 digipine 2017.11.02 3254
56 iOS - Socket Nagle 알고리듬 OFF digipine 2017.11.01 3256
55 iOS - Objective-C 남아있는 메모리 공간 확인 방법 digipine 2017.11.01 3443
54 iOS - NSURLConnection로 다중 다운로드 구현 digipine 2017.11.01 3549
53 iOS - Thread Loop 내에서 UI 업데이트 방법 digipine 2017.11.01 3555
52 iOS - BLE 장치용 ANCS Library for ANCS digipine 2017.11.02 3581
51 OSX 사파리 최신 버전 폰트 변경하기 file digipine 2017.11.03 3632
50 OpenAL PDF, Sample Source file digipine 2017.11.02 3672
49 iOS - NSString의 언어 인코딩 메소드 정리 digipine 2017.11.01 3675
48 iOS - UILabel 에서 AttributeString 사용하기 digipine 2017.11.02 3722
» iOS - View 이동 전환 하기 총정리 digipine 2017.11.01 3835
46 iOS - Sleep Mode Blocking 방법, 앱실행시 슬립모드 진입 방지 digipine 2017.11.01 3937
45 iOS - NSString 와 NSData 간의 데이터 상호 변환 digipine 2017.11.01 3985
44 iOS - OpenURL으로 HTML에서 어플 실행 digipine 2017.11.01 3991
43 iOS - sizeWithFont 메소드 deprecated와 sizeWithAttributes digipine 2017.11.02 4031
42 iOS - BSD Socket 네트워크 프로그래밍 digipine 2017.11.01 4048
41 iOS - Query string을 Decode 하는 소스 digipine 2017.11.01 4064
40 iOS - 코드 수행시간 측정하기 - getTickCount digipine 2017.11.01 4069
39 XCode 8 업데이트 후 Code Sign Error 발생 시 해결법 1 digipine 2017.11.02 4074
38 [iOS, MacOS] NSNotification, NSNotificationCenter 사용법 digipine 2017.11.02 4138
Board Pagination Prev 1 2 3 Next
/ 3