I integrated Adwhirl into my app and activated iAd only. My app is in landscapeleft mode and I want to have all Ads in 320x50(48) mode. I managed to rotate the banner view and the iAd looks right.I did this in the following way:
AdWhirl *adView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
[[[Director sharedDirector] openGLView] addSubview:adView];
CGAffineTransform transform = CGAffineTransformMakeTranslation(0, 150);
transform = CGAffineTransformTranslate(transform, 10, 10);
transform = CGAffineTransformRotate(transform, CC_DEGREES_TO_RADIANS(90));
[adView setTransform:transform];
It works fine in iOS4.2.
However,on device with iOS4.1,only left side of the banner view is clickable.I'm really confused about this behavior.Is there anyone having the same problem?
Any hint would be highly appreciated!
P.S.I tried to set frame,bounds,and center,but that does not solve the problem.
Related
I have implemented code as per the google SDK documentation line by line in my app, but still when I click on google sign in button app shifts to new view controller with webview with blank screen. Have tried multiple solution found here : GIDSignIn white screen on iOS 91. But no lucks with resolving the problem , have attached the screen shot for getting closer look about the screen.
Following are the pods that I'm using,
Running XCode 9.1, iOS 10.0 and later. Kindly request someone to help.
Update: View Hierarchy
Update: viewDidLoad's code:
GIDSignIn.sharedInstance().uiDelegate = self
if self.isChangePassword {
self.addSignInView()
}
else {
self.addSignUpView()
}
fileprivate func addSignInView() {
guard let signInEmailView: SignInEmailView = Bundle.main.loadNibNamed(NibNames.SignInEmailView.rawValue, owner: self, options: nil)?[0] as? SignInEmailView
else {
return
}
signInEmailView.delegate = self
gaManager.trackScreen(screenName: ScreenNames.SignIn.rawValue)
self.animateView(signInEmailView)
}
fileprivate func addSignInView() {
guard let signInEmailView: SignInEmailView = Bundle.main.loadNibNamed(NibNames.SignInEmailView.rawValue, owner: self, options: nil)?[0] as? SignInEmailView
else {
return
}
signInEmailView.delegate = self
gaManager.trackScreen(screenName: ScreenNames.SignIn.rawValue)
self.animateView(signInEmailView)
}
I have the same problem. I use the UIAlertView to confirm user really want to do authorization. It will show the blank screen. If I remove the UIAlertView and show the authorization view directly. It works fine.
The problem also show in the Dropbox authorization screen.
If you not use UIAlertView , please try to pass the top most controller
https://github.com/dropbox/dropbox-sdk-obj-c/issues/182
Hope this can do some help.
Finally after so many days found the problem. I was showing splash view from my appDelegate using refrence of UIWindow which was adding and removing an imgview as subview to the window. So it was somehow messing with the UINavigation's stack and my view controller was not getting any reference to the UINavigationController. After removing that code it's working just fine. Also came to the solution that, if I want to show splash screen, as I can't use UIWindow's reference, I have to add new VC and write my all navigation code there. #TedYu Thank you very much for the help. :)
Simply trying to test retina display. I setup the director like this:
CCDirectorIOS* director = (CCDirectorIOS*)[CCDirector sharedDirector];
director.wantsFullScreenLayout = NO;
director.projection = kCCDirectorProjection2D;
director.animationInterval = 1.0 / 60.0;
director.displayStats = YES;
[director enableRetinaDisplay:YES];
I create two versions of the file in Photoshop - outline-hd.png and outline.png. I color the HD version red so I can tell if it's being displayed.
Display code:
CCSprite *border = [CCSprite spriteWithFile:#"outline.png"];
[self addChild:border];
Yet it is the non-hd image that gets displayed on my iPhone5. Why?
I came across this question while trying to solve the exact same problem in my own project. Had to dig around in the cocos2d source to figure it out. The problem is that the director's enableRetinaDisplay:YES method doesn't work unless the director's view is set. So, it needs to be called after the glView is set up, and you've called setView on the director:
CCGLView *glView = [CCGLView viewWithFrame:aFrame
pixelFormat:kEAGLColorFormatRGBA8
depthFormat:0
preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0];
[[CCDirector sharedDirector] setView:glView];
NSLog(#"glView is set, enable retina...");
[[CCDirector sharedDirector] enableRetinaDisplay:YES];
This should fix the problem for you!
May be you forgot:
CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
[sharedFileUtils setEnableFallbackSuffixes:NO];
[sharedFileUtils setiPhoneRetinaDisplaySuffix:#"-hd"];
I have Default-568#2x.png which loads fine.
However, (on the actual device) after it shows the iPhone 5 then displays Default.png, in letter box mode. It then loads the 1136 × 640 px Title Screen - which is fine and what it's supposed to do.
I'm using the default Cocos2d HelloWorld template. I haven't changed anything in the plist or otherwise.
Any ideas?
Why does it load the Default.png and how do you fix this?
Thanks.
In the IntroLayer we have
-(void) onEnter
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) {
background = [CCSprite spriteWithFile:#"Default.png"];
background.rotation = 90;
}
Which is why Default.png is showing up.
How do you keep showing Default-568h#2x.png if you are using the iPhone 5?
I just added another if statement:
if ([UIScreen mainScreen].bounds.size.height == 568.0) {
background = [CCSprite spriteWithFile:#"Default-568h#2x.png"];
background.rotation = 90;
}
I am trying to integrate AdMob into my cocos2d Game and I having some problems. Basically the ad shows up but when I click on it, the banner disappears and the full view doesn't show up. I am using a slight modified version of the code found on google admob page. Here is my code:
-(void) addAdMobBanner{
NSLog(#"adding Admob");
controller = [[RootViewController alloc]init];
CGSize size = [[CCDirector sharedDirector] winSize];
controller.view.frame = CGRectMake(0,0,size.width,size.height);
// Create a view of the standard size at the bottom of the screen.
bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(size.width/2+50,
size.height-GAD_SIZE_468x60.height,
GAD_SIZE_468x60.width,
GAD_SIZE_468x60.height)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView.adUnitID = #"xxxxxxxxxxxx";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView.rootViewController = controller;
[controller.view addSubview:bannerView];
[[[CCDirector sharedDirector] openGLView]addSubview : controller.view];
[bannerView loadRequest:[GADRequest request]];
}
Thanks guys
It doesn't work on a simulator but it works on the device, but if you are using in the landscape mode you have to transform it yourselves.
I have a Tabbar control (as the root control).
In the first tab, I have a split view, which I programmatically created like so:
UISplitViewController *split = [[[UISplitViewController alloc] init] autorelease];
split.navigationItem.title = #"All";
MasterSplitViewController *root = [[[MasterSplitViewController alloc] init] autorelease];
root.navigationItem.title = #"Areas";
root.detailViewController = detail;
UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:root] autorelease];
split.tabBarItem = controller.tabBarItem;
split.viewControllers = [NSArray arrayWithObjects: nav, detail, nil];
split.delegate = detail;
Everything works fine, except... If I start the app in Landscape mode, then the layout breaks a bit on the Master view.
If the app starts in Portrait, then I rotate to Landscape, then it is fine.
The only scenario when it breaks is when the app starts in Landscape.
When this happens, I check the console and see this message:
Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations. BUT I am not using a two-stage rotation anywhere!!
These 2 functions are overridden:
shouldAutorotateToInterfaceOrientation and willAnimateRotationToInterfaceOrientation
Please see the attached screen shot.
http://img97.imageshack.us/i/screenshot20110405at308.png/
Please help me. Any suggestion would be greatly appreciated. Thanks very much!!
I had this problem.
Add this code to AppDelegate.m.
self.tabBarController.selectedIndex = 0;