1

我似乎无法让 SLComposeViewController 来自 cocos2D 层上的按钮。如果你能看到任何会阻止这个工作的东西,请告诉。任何帮助将不胜感激:NB viewController is a UIViewController

-(void)sceneSelect
{
    NSString *message = [NSString stringWithFormat:@"Twitter Message"];

    NSString *serviceType = [NSString stringWithFormat:@"SLServiceTypeTwitter"];


    if ([SLComposeViewController isAvailableForServiceType:serviceType])
    {
        SLComposeViewController *tweetController = [SLComposeViewController composeViewControllerForServiceType:serviceType];
        [tweetController setInitialText:message];

        tweetController.completionHandler = ^(SLComposeViewControllerResult result){


            if (result == SLComposeViewControllerResultDone){
               //NSLog call
            }
            else if (result == SLComposeViewControllerResultCancelled){
               //NSLog call
            }

            [viewController dismissViewControllerAnimated: YES completion: nil];
        };

        [[[CCDirector sharedDirector]openGLView]addSubview:viewController.view];
        [viewController presentViewController:tweetController animated:YES completion:nil];
    }

    else
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Twitter" message:@"Twitter not working" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];

        [alertView show];
    }
}
4

1 回答 1

0

Cocos2d 2.0 然后在 AppDelegate 中使用导航控制器

    AppController *app = (AppController*) [[UIApplication sharedApplication] delegate];
    [[app navController] presentModalViewController:tweetController animated:YES];

这是我的完整推特代码: http: //pastebin.com/hpRRJM1n

于 2013-04-25T09:27:39.627 回答