0

このコードを使用して、ios sdk であるビューから別のビューに移行しますが、コードがトリガーされても、前のビューに戻ると機能しません...

UIView *currentView = self.viewController1.view;

// get the the underlying UIWindow, or the view containing the current view view
UIView *theWindow = [currentView superview];

// remove the current view and replace with myView1
[currentView setHidden:TRUE];//hide previous view diladi to tabviewcontroller
self.viewController1=[[MyFriendProfile alloc] initWithNibName:@"MyFriendProfile" bundle:nil];
[theWindow addSubview:self.viewController1.view];
[currentView setHidden:FALSE]; 
// 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:@"SwitchToView2"];

どんな助けでも大歓迎です!

4

1 に答える 1

1

ここでの答えはコードです...

//viewcontroller1ビューを取得します

UIView * currentView = self.viewController1.view;

// get the the underlying UIWindow, or the view containing the current view view
UIView *theWindow = [currentView superview];

// remove the current view and replace with myView1
[currentView setHidden:TRUE];//hide previous view diladi to tabviewcontroller


MyFriendProfile *test1=[[MyFriendProfile alloc] initWithNibName:@"MyFriendProfile" bundle:nil];


[theWindow addSubview:test1.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"];
于 2011-11-01T18:30:03.933 に答える