2012-07-10 5 views
0

L'iOS Sharekit travailler avec Xcode précédent mais 4.2 il ne fonctionne plus, quand je frappe le bouton Annuler il va à cette routineiOS ShareKit bouton Annuler ne fonctionne pas avec Xcode 4.2

A l'intérieur du 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; 
} 

}

Je le code étagé et il vient de frapper si (isDissmissingView) et juste retour.
Donc, j'ai inséré manuellement le code

[[currentView parentViewController] dismissModalViewControllerAnimated:animated]; 

au sommet de la routine, mais cela ne fait rien.

I comprend également d'autres codes pour référence

- (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) {hideCurrentViewController [auto hideCurrentViewControllerAnimated: OUI]; }

Répondre

1

Il s'agit d'une erreur connue qui s'est produite sur ios5. Cela a été corrigé il y a longtemps dans ShareKit 2.0. Si vous décidez de mettre à niveau, assurez-vous de suivre très attentivement et littéralement new install wiki, car beaucoup de choses ont changé par rapport au Sharekit original .

Questions connexes