Custom view transition in OpenGL ES

前端 未结 4 1056
野趣味
野趣味 2021-02-01 10:21

I\'m trying to create a custom transition, to serve as a replacement for a default transition you would get here, for example:

[self.navigationController pushVie         


        
4条回答
  •  臣服心动
    2021-02-01 10:56

    While I cannot completely answer your question without doing some more research of my own, I can help a bit:

    -In order to get the view of a UINavigationController, you need to take a screenshot. The easiest way to do this is by grabbing it into a UIImage:

    UIGraphicsBeginImageContext(self.view.frame.size);
    [[self.view layer] renderInContext:UIGraphicsGetCurrentContext()];
    UIImage* test = UIGraphicsGetImageFromCurrentImageContext();
    UIImageView* view = [[UIImageView alloc] initWithImage:test];
    UIGraphicsEndImageContext();
    

    I am not sure if you can render a GLContext (not familiar on the phone) into a CGImage, but I would do something like that (and init a UIImage from that). I would prerender every frame of the animation you are trying to do and slap it into an UIImageView using the animation stuff provided within. That is, if your animation is simple enough. Otherwise, it might come down to writing your own animation function :-/

提交回复
热议问题