이 사이트와 인터넷 전체에서 검색하려했지만 여러보기 컨트롤러간에 데이터를 공유하면서 전환 할 수있는 방법을 찾지 못했습니다. 나는 다음과 같은 코드를 사용하려고 (첫 번째 방법은 다른 방법은 다음보기를 전환 호출) :보기 컨트롤러 전환
-(IBAction) choosePhoto:(id)sender {
[self startMediaBrowserFromViewController: self
usingDelegate: self];
if(firstViewController.view.superview == nil)
{
[secondViewController viewWillAppear:YES];
[firstViewController viewWillDisappear:YES];
[firstViewController.view removeFromSuperview];
[self.view insertSubview:self.secondViewController.view atIndex:0];
[firstViewController viewDidDisappear:YES];
[secondViewController viewDidAppear:YES];
}
//3. now add animation
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//blue view will appear by flipping from right
if (secondViewController.view.superview == nil)
{
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight
forView:self.view cache:YES];
[secondViewController viewWillAppear:YES];
[firstViewController viewWillDisappear:YES];
[firstViewController.view removeFromSuperview];
[self.view insertSubview:self.secondViewController.view atIndex:0];
[firstViewController viewDidDisappear:YES];
[secondViewController viewDidAppear:YES];
}
[UIView commitAnimations];
}
- (IBAction)switchViews:(id)sender {
if(self.secondViewController.view.superview == nil)
{
[firstViewController.view removeFromSuperview];
[self.view insertSubview:secondViewController.view atIndex:0];
}
}
이 멋진 애니메이션을 수행하지만, 뷰 컨트롤러를 전환하지 않습니다.
도와주세요.
EDIT : 또한 첫 번째보기 컨트롤러 내부에 다른보기를 배치하고보기를 전환하는 방법이 유용 할 것입니다.
비디오 이름은 무엇입니까? –
비디오의 이름은 "Implementing UIViewController Containment", 세션 102, 2011 년 6 월 15 일입니다. iTunes Store를 통해 비디오에 액세스 할 수 있습니다. – smileBot