gpt4 book ai didi

iOS ShareKit 取消按钮不适用于 Xcode 4.2

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

iOS Sharekit 可以与以前的 Xcode 一起使用,但在 4.2 中它不再工作,当我点击“取消”按钮时,它会转到此例程

SHK.m内幕

  - (void)hideCurrentViewControllerAnimated:(BOOL)animated
{


if (isDismissingView)
return;

if (currentView != nil)
{
// Dismiss the modal view
if ([currentView parentViewController] != nil)
{
self.isDismissingView = YES;
[[currentView parentViewController] dismissModalViewControllerAnimated:animated];
}

else
self.currentView = nil;
}

}

我单步执行代码,它只是命中 if (isDissmissingView) 并且它只是返回。
所以,我手动插入了代码

   [[currentView parentViewController] dismissModalViewControllerAnimated:animated];

到例程的顶部,但这没有任何作用。

我还提供了一些其他代码供引用

  - (void)showViewController:(UIViewController *)vc

{

  if (rootViewController == nil)
{
// Try to find the root view controller programmically

// Find the top window (that is not an alert view or other window)
UIWindow *topWindow = [[UIApplication sharedApplication] keyWindow];
if (topWindow.windowLevel != UIWindowLevelNormal)
{
NSArray *windows = [[UIApplication sharedApplication] windows];
for(topWindow in windows)
{
if (topWindow.windowLevel == UIWindowLevelNormal)
break;
}
}

UIView *rootView = [[topWindow subviews] objectAtIndex:0];
id nextResponder = [rootView nextResponder];

if ([nextResponder isKindOfClass:[UIViewController class]])
self.rootViewController = nextResponder;

else
NSAssert(NO, @"ShareKit: Could not find a root view controller. You can assign one manually by calling [[SHK currentHelper] setRootViewController:YOURROOTVIEWCONTROLLER].");
}

// Find the top most view controller being displayed (so we can add the modal view to it and not one that is hidden)
UIViewController *topViewController = [self getTopViewController];
if (topViewController == nil)
NSAssert(NO, @"ShareKit: There is no view controller to display from");


// If a view is already being shown, hide it, and then try again
if (currentView != nil)
{
self.pendingView = vc;
[[currentView parentViewController] dismissModalViewControllerAnimated:YES];
return;
}

// Wrap the view in a nav controller if not already
if (![vc respondsToSelector:@selector(pushViewController:animated:)])
{
UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease];

if ([nav respondsToSelector:@selector(modalPresentationStyle)])
nav.modalPresentationStyle = [SHK modalPresentationStyle];

if ([nav respondsToSelector:@selector(modalTransitionStyle)])
nav.modalTransitionStyle = [SHK modalTransitionStyle];

nav.navigationBar.barStyle = nav.toolbar.barStyle = [SHK barStyle];

[topViewController presentModalViewController:nav animated:YES];
self.currentView = nav;
}

// Show the nav controller
else
{
if ([vc respondsToSelector:@selector(modalPresentationStyle)])
vc.modalPresentationStyle = [SHK modalPresentationStyle];

if ([vc respondsToSelector:@selector(modalTransitionStyle)])
vc.modalTransitionStyle = [SHK modalTransitionStyle];

[topViewController presentModalViewController:vc animated:YES];
[(UINavigationController *)vc navigationBar].barStyle =
[(UINavigationController *)vc toolbar].barStyle = [SHK barStyle];
self.currentView = vc;
}

self.pendingView = nil;

}

  • (void)隐藏CurrentViewController{[ self 隐藏CurrentViewControllerAnimated:是];}

最佳答案

这是一个已知错误,出现在 ios5 上。这个问题很久以前就已经在 ShareKit 2.0 中修复了。 。如果您决定升级,请务必关注new install wiki非常仔细和字面意思,因为与原始共享包相比,很多事情都发生了变化.

关于iOS ShareKit 取消按钮不适用于 Xcode 4.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11405457/

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