modal view dialog http://i42.tinypic.com/2sbr90j.gif
当我单击“设置”按钮时,我希望对话框水平翻转以显示设置对话框.
我有这个工作正常.但是,当dailog翻转时会显示背景颜色.如你看到的:
here http://i41.tinypic.com/2gt3u4l.gif
当对话框翻转时,有没有办法不让这块颜色可见?我希望它看起来更加无缝 – 好像它是一张纸翻转.
这些观点基本上是这样的:
解决方法 我认为没有办法使用modalPresentationStyle做你想做的事.您需要使用以下方法使用过渡动画自己实现动画:Window
Main VIEw. Set to the window’s rootVIEwController
Login modal vIEw
因此,主窗口和根控制器的设置如下(在app delegate类中):
- (BOol)application:(UIApplication *)application dIDFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.vIEwController = [[MainVIEwController alloc] initWithNibname:@"MainVIEw" bundle:nil]; self.window.rootVIEwController = self.vIEwController; [self.window makeKeyAndVisible]; return YES;}登录窗口已设置并显示在主视图的vIEwDIDAppear中:
- (voID)vIEwDIDAppear:(BOol)animated{ [super vIEwDIDAppear:animated]; // Setup and show Login dialog LoginVIEwController* controller = [[LoginVIEwController alloc] initWithNibname:@"LoginVIEw" bundle:nil]; controller.delegate = self; controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical; controller.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalVIEwController:controller animated:YES];}按下“设置”按钮时:显示“设置”模式视图的方式与登录模式视图的显示方式非常相似:
- (IBAction)settingsbutton@R_301_4848@:(ID)sender { SettingsVIEwController *controller = [[SettingsVIEwController alloc] initWithNibname:@"SettingsVIEw" bundle:nil]; controller.delegate = self; controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; controller.modalPresentationStyle = UIModalPresentationCurrentContext; [self presentModalVIEwController:controller animated:YES]; }
+ (voID)TransitionFromVIEw:(UIVIEw *)fromVIEw toVIEw:(UIVIEw *)toVIEw duration:(NSTimeInterval)duration options:(UIVIEwAnimationoptions)options completion:(voID (^)(BOol finished))completion
使用UIVIEwAnimationoptionTransitionFlipFromleft选项.
在这种情况下,您要翻转的新视图不是模态(controller.vIEw)的内容,而是模态框架本身,因此只需从设置按钮调用上面的方法,而不是传递controller.vIEw,替换controller.vIEw.supervIEw,如果这不起作用,请尝试controller.vIEw.supervIEw.supervIEw,直到动画看起来正确.
这将需要一些调整来确切地知道如何做到这一点.
总结以上是内存溢出为你收集整理的objective-c – 从一个模态视图无缝翻转到另一个模态视图,而不显示纯色背景全部内容,希望文章能够帮你解决objective-c – 从一个模态视图无缝翻转到另一个模态视图,而不显示纯色背景所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)