我正在使用 GLSprite 基本代码。我有一个 EAGLAppDelegate 和一个 EAGLView。我尝试向委托添加一个 navController 变量:
// AppDelegate.h
@property (nonatomic, strong) UINavigationController *navController;
// AppDelegate.m
@synthesize navController = _navController;
然后在 touchesBegan 中执行以下操作(用于测试),但 navController 为 NULL 并且什么都没有出现?我怎样才能解决这个问题?
GLSpriteAppDelegate *ad = (GLSpriteAppDelegate *)[[UIApplication sharedApplication] delegate];
SLComposeViewController *fbController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){
[fbController dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
NSLog(@"Cancelled.....");
break;
case SLComposeViewControllerResultDone:
NSLog(@"Posted....");
break;
}};
//[fbController addImage:[UIImage imageNamed:@"1.jpg"]];
[fbController setInitialText:@"Test message"];
[fbController addURL:[NSURL URLWithString:@"http://www.test.com"]];
[fbController setCompletionHandler:completionHandler];
[ad.navController presentViewController:fbController animated:YES completion:nil];