이 코드는 tabviewcontroller의 Uiview와 새로운 uiview 사이를 전환하는 데 필요한 코드입니다. 코드는 tabviewcontroller의 UI 중 하나에있는 버튼의 IBAction으로 이동합니다.
// 앱 대리자
AppDelegate에 AppDelegate에 = (AppDelegate에) [UIApplication sharedApplication] 위임] 초기화;
// 현재
에 UIView를 보여주는 것보기를 얻을 * currentView = self.view;
// 상기 하부 UIWindow 또는 현재 뷰 뷰
UIView의 theWindow * = [currentView의 수퍼]를 포함하는 뷰를 얻는다;
// remove the current view and replace with mynewView1
[currentView removeFromSuperview];
// viewcontroller1에 새보기를 할당하십시오. 이것은 uitabbarcontroller의 첫 번째 컨트롤러입니다. 내 uitabbarcontroller 내 프로젝트에 5 uiviewcontrollers로 구성되어 있습니다. 버튼이 첫 번째 viewcontroller1에 존재하므로 이것이 새로운 뷰를 viewcontroller1에 할당하는 이유입니다.버튼은 내가 secondviewcontroller (viewcontroller2)에 새보기를 할당합니다 내 UITabBarController가의 secondviewcontroller (viewcontroller2)에서 누르면 등등 ...
appDelegate.viewController1=[[MyMessages alloc] initWithNibName:@"MyMessages" bundle:nil];
// 창
[theWindow addSubview:appDelegate.viewController1.view];
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
에 추가 된 경우
도움 주셔서 감사합니다. 나는 그것을 달성하기 위해 하루 이상 동안 이것을 해왔다. 나는 그것이 동일한 문제를 가진 누군가를 도울 것이라는 점을 희망한다.
당신이 바로 Radu Lucaciu였습니다. 다음을해야했습니다. – stefanosn
아래에서 내 asnwer를 확인해보십시오. 나는 코멘트로 올릴 수 없습니다. – stefanosn