gpt4 book ai didi

iphone - UIModalTransitionStylePartialCurl 不会返回到以前的状态。 (不解雇)

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:54:15 28 4
gpt4 key购买 nike

我有 2 个 View Controller ,比方说 A 和 B。在 A 中,我调用 B 以使用过渡样式 UIModalTransitionStylePartialCurl

[b setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:b animated:YES];

它工作正常。但是当我在用 iOS 4.3 编译的程序中按下 curl 区域时。它根本不解雇。它不会返回到 View Controller ...

最有趣的是这个curl在用iOS 5.0编译的应用程序中是活跃的并给出响应。

我该如何解决这个问题?
此外,为什么它不关闭 B View Controller 并返回到 A ?

最佳答案

这是Modal View Controllers Apple 网站的链接

基本上,您需要设置委托(delegate)等。并从您的 View Controller A 调用 dismissModalViewControllerAnimated: 方法。如果您需要进一步的帮助,请告诉我。

根据 MiiChiel 编辑:

在 BController.h 文件中,添加:

@protocol BControllerDelegate <NSObject>
-(void)dismissMe;
@end

@interface BController : UIViewController
//...
@property (assign) id <BControllerDelegate> delegate;
//...
@end

在 BController.m 文件中,添加:

@implementation BController
@synthesize delegate;
//...
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.delegate dismissMe];
}

在 AController.h 文件中,添加:

#import "BController.h"

@interface AController : UIViewController <BControllerDelegate>

在 AController.m 文件中,添加:

//add this line before presenting the modal view controller B
bController.delegate = self; // assuming bController is the name of the modal

-(void)dismissMe
{
//call back from modal view to dismiss it
[self dismissModalViewControllerAnimated:YES];
}

关于iphone - UIModalTransitionStylePartialCurl 不会返回到以前的状态。 (不解雇),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8606674/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com