gpt4 book ai didi

ios - 将 Delegate 设置为自身 PaperFoldMenuController

转载 作者:行者123 更新时间:2023-11-29 04:09:19 24 4
gpt4 key购买 nike

我正在努力获取这个PaperFoldMenuController虽然工作正常,但在设置 foldMenuViewController.delegate = self 时出现错误我就是Assigning to 'id<PaperFoldMenuControllerDelegate>' from incompatible type 'DOAppDelgate *const__strong' 。我将它分配在与演示完全相同的位置,该演示似乎运行良好。有什么想法吗?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
DOMasterViewController *controller = (DOMasterViewController *)navigationController.topViewController;
controller.managedObjectContext = [self managedObjectContext];

foldMenuViewController = [[DOMenuViewController alloc] initWithMenuWidth:200 numberOfFolds:5];
foldMenuViewController.delegate = self;
[self.window setRootViewController:foldMenuViewController];

NSMutableArray* viewControllers = [NSMutableArray array];
[viewControllers addObject:navigationController];
[viewControllers addObject:controller];

[foldMenuViewController setViewControllers:viewControllers];

return YES;
}

最佳答案

您可能需要您的类来实现协议(protocol):PaperFoldMenuControllerDelegate

@interface DOAppDelgate()<PaperFoldMenuControllerDelegate>
- (BOOL)paperFoldMenuController:(PaperFoldMenuController *)paperFoldMenuController shouldSelectViewController:(UIViewController *)viewController;
- (BOOL)paperFoldMenuController:(PaperFoldMenuController *)paperFoldMenuController shouldFoldMenuToRevealViewController:(UIViewController *)viewController;
- (void)paperFoldMenuController:(PaperFoldMenuController *)paperFoldMenuController didSelectViewController:(UIViewController *)viewController;
@end

...然后实现这些方法。

编辑:将实现更改为接口(interface),mybad。

关于ios - 将 Delegate 设置为自身 PaperFoldMenuController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14668813/

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