A transparent UITableView on top of several UIViewController and OpenGLView (Cocos2D)

Here is my code:

// View Controller with navigation bar InAppPurchaseViewController *purchaseViewController = [[InAppPurchaseViewController alloc] init]; purchaseViewController.title = @"Magasin"; purchaseViewController.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissViewController:)] autorelease]; UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:purchaseViewController] autorelease]; // Add `purchaseViewcontroller` TO container AND container ON openGLView UIViewController *container = [[UIViewController alloc] init]; [container setView:[[CCDirector sharedDirector] openGLView]]; [container setModalTransitionStyle: UIModalTransitionStyleCoverVertical]; [container presentViewController:navController animated:YES completion:nil]; 

UITableView is in buyViewController.

I was thinking of using [UIColor clearColor] , BUT whatever I use, I get a BLACK background on my UITableView . Cells become unselectable and indestructible (except for elements that are in cells)

EDIT: appdelegate

Here is the .h

 @class AudioEngine; @class RootViewController; @class Score; @interface AppDelegate : NSObject <UIApplicationDelegate, GameCenterManagerDelegate> @property int CurrentPackage; @property int CurrentScore; @property int CurrentHighScore; @property BOOL SoundShouldPlay; @property BOOL PauseScreenUp; @property(nonatomic, retain) AudioEngine *CustomAudioEngine; @property(nonatomic, retain) GameCenterManager *CustomGameCenterManager; @property(nonatomic, retain) UIWindow *window; @property(nonatomic, readonly) RootViewController *ViewController; @property(nonatomic, retain) NSString* CurrentLeaderBoard; @property(nonatomic, retain) NSMutableArray *TenLastScoresArray; +(AppDelegate *)get; -(void)connectToGameCenter; -(void)addScoreToLastScore:(Score*)score; 

And this method completed the launch

 -(void)applicationDidFinishLaunching:(UIApplication*)application { CC_DIRECTOR_INIT(); self.CurrentLeaderBoard = kLeaderboardID; [[SKPaymentQueue defaultQueue] addTransactionObserver:[InAppPurchaseSingleton sharedHelper]]; [AudioEngine preloadBackgroundMusic]; [AudioEngine playBackgroundMusic:3]; self.SoundShouldPlay = YES; [SceneManager goSplash]; } 
+4
source share
1 answer

Instead of presenting the view controller to container :

 UIViewController *container = [[UIViewController alloc] init]; ... [container presentViewController:navController animated:YES completion:nil]; 

what should work presents it on the root view controller, the cocos2D template created for you. It is usually available through the application delegate:

 UIViewController *rootViewController = (UIViewController*)[(YOURAPPDELEGATE*)[[UIApplication sharedApplication] delegate] viewController]; [rootViewController presentViewController:navController animated:YES completion:nil]; 

viewController is ivar that the default cocos2D template adds an application delegation class. It is usually private, so you need to define an accessor:

 @property (nonatomic, readonly) RootViewController *viewController; //-- .h file @synthesize viewController; //-- .m file 

Hope this helps.

EDIT:

Based on what I have in my application, I think you can try and create an instance of RootViewController as follows:

  CC_DIRECTOR_INIT ViewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; ViewController.wantsFullScreenLayout = YES; [ViewController setView:[[CCDirector sharedDirector] openGLView]]; ... 
+3
source

Source: https://habr.com/ru/post/1432938/


All Articles