iphone - View Controller 之间的自定义转换?

标签 iphone objective-c cocoa uikit ipad

有没有一种好方法可以在 View Controller 之间提供自定义转换?例如,在 iPad 上的“照片”应用中,点击相册会更改导航 Controller ,但它也会很好地融入照片网格中。

谢谢。

最佳答案

如果您所指的漂亮动画是照片网格从右侧滑入 View ,则由 UINavigationController 自动处理。您只需告诉它您想要显示哪个 View ,它就会为您处理幻灯片动画。

这将设置导航 Controller ,其中包含您的第一个 View (相册表格)。

// init your first view controller here, create a navigation controller for it
UIViewController *myRootViewController;
UINavigationController *myNavController;
myNavController = [[UINavigationController alloc]
                   initWithRootViewController:[myRootViewController view]];
// the nav controller now owns your first view
[myRootView release];
// add the nav controller view (ie. do this in the app delegate)
[window addSubView:[myNavController view]];

然后创建第二个 View (照片网格)并要求导航 Controller 显示它。

// init your second view controller here
UIViewController *mySecondViewController;
[myNavController pushViewController:[mySecondViewController view] animated:YES];
[mySecondView release];

关于iphone - View Controller 之间的自定义转换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2941222/

相关文章:

iphone - 复制 Photoshop "Multiply effects"

objective-c - 更新从文本字段绑定(bind)的属性,无需按 Enter 键

cocoa - 创建带有回复字段的通知

iphone - 应用程序内购买无法正常工作。它给出 "Can not connect to itunes"

iphone - iPhone 中的 SQLite

iphone - 为什么必须导入我的委托(delegate)头文件?

ios - 很简单——我无法在方法 B 中访问我在方法 A 中声明的对象

iphone - 从 contentViewController 中消除 UIPopOverController

objective-c - 如何计算RGB颜色的亮度?

swift - 在 swift 中使用 NSpopover。如何更改顶部栏