프로그램 Appdelegate에서 해제할 필요가 없는 특정 컨트롤러를 가져옵니다. 새로 만들지 않음 -----IOS

885 단어 iosoc
---------------------------전재는 출처를 밝혀 주십시오----------------------------
appdelegate의.h에서 @property(nonatomic,strong)CenterDrawerViewController*centerViewController1의 속성을 설명합니다.
.m에 새 self.centerViewController1 = [[CenterDrawerViewController alloc] init];
다음은 다른 컨트롤러에서 Appdelegate의centerViewController1을 받아야 합니다.
UIApplication* application = [UIApplication sharedApplication];
            AppDelegate* appdelegate = application.delegate;
            CenterDrawerViewController * centerViewController = appdelegate.centerViewController1;

이렇게 하는 장점은 우리 프로젝트에서 필요한 서랍 효과나 다른 페이지 전환 효과가 있을 때 이 페이지에서 다른 페이지로 전환하고 마지막에 원래의 페이지로 전환할 때이다.원래의 페이지는 새로 만들지 않아서 사용자의 일부 데이터를 절약할 수 있다.새로 만들기를 피했다.사용자는 드롭다운 새로 고침을 통해서만 새로 고침 기능을 터치할 수 있습니다.
하나의 해결 방법이지만 데이터 지속화(NSData와 압축 파일)를 이용하여 이 기능을 완성하는 것을 추천합니다. 이것은 임시변통의 방법일 뿐입니다. 재미만 있으면 실현해 보세요.

좋은 웹페이지 즐겨찾기