简体   繁体   中英

Weird segue animation in xcode

Ok guys this is killing me. I have 10 "view controllers" in a row across my storyboard. All ten use the same .h and .m file. Each has a segue connecting it to the next one in line. All of the segues have the following identifier: segueToNextPage. I'm calling the segue with this method:

-(void)myMethod {
// other code 

[NSTimer scheduledTimerWithTimeInterval:4 target:(self) selector:@selector(nextPage) userInfo:(nil) repeats:NO];
}


-(void)nextPage {

    [self performSegueWithIdentifier: @"segueToNextPage" sender: self];
}

On the storyboard I have set the segue's transition to cross dissolve. I have also set the transition style of all "view controllers" on the storyboard to cross dissolve. The segue works fine when called except it does this corner to corner spin/flip animation not the cross dissolve as i had expected.

I made a test project with just two pages just to be sure that I wasn't losing my mind and everything works as expected if I use this code and connect it to a round rect button:

-(IBAction)nextPage {

    [self performSegueWithIdentifier: @"segueToNextPage" sender: self];
} 

Can anyone spare the time to explain why my first example doesn't work as expected. It would be greatly appreciated.

I replicated your code and it seemed to work without a problem. The only issue that I can think of is that by defining the "segueToNextPage" segue multiple times in the StoryBoard you are potentially overwriting its definition each time. You should check each one of the transitions and make sure that one of them is not set to "Flip Horizontal"

Im still not sure whats causing this to happen with those ten "view controllers" on the storyboard but making a new .h and .m with the exact same code in it then hooking those to ten new view controllers on the storyboard has fixed the issue. I was even able to copy and paste the contents of the original view controllers into the new ones. Still very strange but for now problem solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM