问题
I have two classes, machineClass and buttonsClass... From buttons class, I want a button to programmatically push into the machineClass.
Ive gotten that to work with:
machineClass *mc = [self.storyboard instantiateViewControllerWithIdentifier:@"machineClass"];
mc.passedString = purchase;
[self presentViewController:mc animated:YES completion:nil];
However, this uses the default segue animation (where the view comes up vertically), and I think my app would look so much nicer if I used the cross dissolve transition instead.
Can anyone help? The best solution I've come up with is to change it to:
[self presentViewController:mc animated:NO completion:nil];
But I don't like this as much...
Thanks!
回答1:
You can set the target view controller's modal transition style in the storyboard. Or in code:
machineClass *mc = [self.storyboard instantiateViewControllerWithIdentifier:@"machineClass"];
mc.passedString = purchase;
mc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:mc animated:YES completion:nil];
来源:https://stackoverflow.com/questions/14866682/objective-c-segues-dissolve-programmatically