Objective C Segues, dissolve programmatically

对着背影说爱祢 提交于 2019-12-13 00:27:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!