The iPhone has a set of nice transition animations which makes the experience using it very pleasant. But after a while one get so used of them that one stop noticing that they are even there. But this is not necessary a bad thing. Often I think thatreallygood things doesn’t show at all, they don’t get in the way. In 3D application really good things make the experience so natural that one afterwards can wonder what the big deal was,reallyimpressive 3D isn’t at all impressive. But, this is not about not noticing. After a while one maybe want to make that little extra in an iPhone app ie making a view transition more natural for the app. Some ebook readers have made page turning transitions.
I have for some time had the notion how to implement it, but as always,But frankly, nothing is really solved until it is shown to work.So, this weekend I set out to make a reusable class for a OpenGL ES based view transition animation.
My idea was basically as following
- Make a screen shot of the current view
- Create a texture of the screen shot
- Create a view with an OpenGL ES context, make it
opaque=NO
- Make it reusable with a delegate protocol for animation parts
Said and done. So how did this work? I’d say it worked pretty good. Maybe there is better ways to go from screen shot to texture but the well used screen grabbing code is solid.
UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Autilityshould be valued by how easy it is used. Too often I see OOP programmers making no effort at simplify a framework. Read aboutpseudo-classes. So how much has to be done to use this transition view? It boils down to two parts, the actual animation and the integration into Cocoa touch views. The actual animation calls are what they are, but I separated it into two delegate methods,setupTransition
anddrawTransitionFrame
. Then creating the objects and make use of them can look like this (from the demo project using theUtility ApplicationXcode template).
- (IBAction)showInfo {
FlipsideViewController *controller = [[FlipsideViewController alloc]
initWithNibName:@"FlipsideView"
bundle:nil];
controller.delegate = self;
// Create animation delegate
DemoTransition *transition = [[[DemoTransition alloc] init] autorelease];
// Create animation view and feed the delegate
EPGLTransitionView *glview = [[[EPGLTransitionView alloc]
initWithView:self.view
delegate:transition] autorelease];
[glview startTransition];
// Animation will be run on top off next view
[self presentModalViewController:controller animated:NO];
[controller release];
}
Update:Added features to include transition into next view, grabbing next view as a texture and making it available for thedrawTransitionFrame
method
Grab the source code and a Xcode demo project atgithub
相关推荐
类似iBooks的3D仿真翻页效果: 1.基于OpenGL 2.0 2.纯Java实现(JNI正在开发中) 3.基于
一款老版本的iBook 可供iOS6使用(界面是拟物化的)
Android 模拟iBooks电子书翻页原理 android开发小例子
ios5.01 应急修复ibooks闪退的小程序 deb格式 可用同步助手 itools等工具安装
epub格式 直接导入ibooks观看 The Swift Programming Language (Swift 4)方式,....摘要居然要大于100个子,这是不是...
app-development-with-swift-student-guide.ibooks 《app-development-with-swift-student-guide》
ibooks支持什么格式?iBooks支持txt电子书吗?.docx
ibooks-亮点如果Mac上具有iBooks突出显示/注释(也应与其他iCloud设备同步),则可以使用此模块从存储于其中的晦涩sqlite数据库中提取它们。 提取JSON中的突出显示并将其分散到控制台的示例: $ npm install ibooks-...
Swift 官方中文文档20190603最新收录。
ipad如何使用iBooks.docx
iBooks Author V2.6版本 网络上大多是从 Apple 官网转的链接,基本已经失效,无法下载 目前功能已经整合进入 Pages 当中 iBooks Author 目前仍能在 Mac OS X 10.15 之前的系统使用
通过自定义UITableViewCell实现ibooks的图书列表样式。
基于iBooks,Author的电子教材设计与开发
Node cli工具,该工具可获取有声读物文件并应用曲目编号和专辑名称,以便iBooks可以对文件进行正确分组 重要的 不要在您唯一的文件副本上立即运行脚本! 该脚本会将文件更改到适当的位置,因此请确保先在较小的文件...
整理了一下吴恩达网上深度学习教学网站的资料,制作成了ibooks格式,可以在osx或者ios上面看的,希望可以帮到大家。
ibooks author 如何把自选图形设为背景.docx
仿iphone-ibooks的反转视图特效,左右滑动可以反转aboveview和backview,上下滑动依然由aboveview处理
《iOS 人机界面准则》中文版.ibooks