diff --git a/cocos2dx/platform/ios/FontLabel/FontLabel.m b/cocos2dx/platform/ios/FontLabel/FontLabel.m index 1e97d650d9..3e60ad6b78 100644 --- a/cocos2dx/platform/ios/FontLabel/FontLabel.m +++ b/cocos2dx/platform/ios/FontLabel/FontLabel.m @@ -118,18 +118,17 @@ } size.width = MIN(size.width, origSize.width); // adjust the point for alignment - switch ((NSTextAlignment)self.textAlignment) { - case NSTextAlignmentLeft: + switch (self.textAlignment) { + case UITextAlignmentLeft: break; - case NSTextAlignmentCenter: + case UITextAlignmentCenter: point.x += (origSize.width - size.width) / 2.0f; break; - case NSTextAlignmentRight: + case UITextAlignmentRight: point.x += origSize.width - size.width; break; - case NSTextAlignmentJustified: - case NSTextAlignmentNatural: - default: break; + default: + break; } [self.text drawAtPoint:point forWidth:size.width withZFont:actualFont lineBreakMode:self.lineBreakMode]; } else { diff --git a/cocos2dx/platform/ios/FontLabel/FontLabelStringDrawing.m b/cocos2dx/platform/ios/FontLabel/FontLabelStringDrawing.m index bad5abd028..f7fcbf1a72 100644 --- a/cocos2dx/platform/ios/FontLabel/FontLabelStringDrawing.m +++ b/cocos2dx/platform/ios/FontLabel/FontLabelStringDrawing.m @@ -637,19 +637,18 @@ static CGSize drawOrSizeTextConstrainedToSize(BOOL performDraw, NSString *string // draw if (performDraw) { - switch ((NSTextAlignment)alignment) { - case NSTextAlignmentLeft: + switch (alignment) { + case UITextAlignmentLeft: drawPoint.x = 0; break; - case NSTextAlignmentCenter: + case UITextAlignmentCenter: drawPoint.x = (constrainedSize.width - lineSize.width) / 2.0f; break; - case NSTextAlignmentRight: + case UITextAlignmentRight: drawPoint.x = constrainedSize.width - lineSize.width; break; - case NSTextAlignmentJustified: - case NSTextAlignmentNatural: - default: break; + default: + break; } NSUInteger stopGlyphIdx = glyphIdx; NSUInteger lastRunIdx = currentRunIdx; diff --git a/samples/HelloCpp/proj.ios/RootViewController.mm b/samples/HelloCpp/proj.ios/RootViewController.mm index fee0d0c071..7376e21c9a 100644 --- a/samples/HelloCpp/proj.ios/RootViewController.mm +++ b/samples/HelloCpp/proj.ios/RootViewController.mm @@ -57,15 +57,21 @@ return UIInterfaceOrientationIsLandscape( interfaceOrientation ); } -// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead -- (NSUInteger) supportedInterfaceOrientations{ - return UIInterfaceOrientationMaskLandscape; +// For ios6.0 and higher, use supportedInterfaceOrientations & shouldAutorotate instead +- (NSUInteger) supportedInterfaceOrientations +{ +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif } - (BOOL) shouldAutorotate { return YES; } + + + - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; diff --git a/samples/HelloLua/proj.ios/RootViewController.mm b/samples/HelloLua/proj.ios/RootViewController.mm index fee0d0c071..cccdbab91e 100644 --- a/samples/HelloLua/proj.ios/RootViewController.mm +++ b/samples/HelloLua/proj.ios/RootViewController.mm @@ -59,7 +59,9 @@ // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead - (NSUInteger) supportedInterfaceOrientations{ - return UIInterfaceOrientationMaskLandscape; +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif } - (BOOL) shouldAutorotate { diff --git a/samples/SimpleGame/proj.ios/RootViewController.mm b/samples/SimpleGame/proj.ios/RootViewController.mm index fee0d0c071..cccdbab91e 100644 --- a/samples/SimpleGame/proj.ios/RootViewController.mm +++ b/samples/SimpleGame/proj.ios/RootViewController.mm @@ -59,7 +59,9 @@ // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead - (NSUInteger) supportedInterfaceOrientations{ - return UIInterfaceOrientationMaskLandscape; +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif } - (BOOL) shouldAutorotate { diff --git a/samples/TestCpp/proj.ios/Classes/RootViewController.mm b/samples/TestCpp/proj.ios/Classes/RootViewController.mm index 7e47e134a8..db521bb0ce 100644 --- a/samples/TestCpp/proj.ios/Classes/RootViewController.mm +++ b/samples/TestCpp/proj.ios/Classes/RootViewController.mm @@ -42,7 +42,9 @@ // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead - (NSUInteger) supportedInterfaceOrientations{ - return UIInterfaceOrientationMaskLandscape; +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif } - (BOOL) shouldAutorotate { diff --git a/samples/TestJavascript/proj.ios/RootViewController.mm b/samples/TestJavascript/proj.ios/RootViewController.mm index 39200bd7c3..7a0d59ccc9 100644 --- a/samples/TestJavascript/proj.ios/RootViewController.mm +++ b/samples/TestJavascript/proj.ios/RootViewController.mm @@ -42,7 +42,9 @@ // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead - (NSUInteger) supportedInterfaceOrientations{ - return UIInterfaceOrientationMaskLandscape; +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif } - (BOOL) shouldAutorotate { diff --git a/samples/TestLua/proj.ios/RootViewController.mm b/samples/TestLua/proj.ios/RootViewController.mm index fee0d0c071..cccdbab91e 100644 --- a/samples/TestLua/proj.ios/RootViewController.mm +++ b/samples/TestLua/proj.ios/RootViewController.mm @@ -59,7 +59,9 @@ // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead - (NSUInteger) supportedInterfaceOrientations{ - return UIInterfaceOrientationMaskLandscape; +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif } - (BOOL) shouldAutorotate { diff --git a/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm b/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm index 7ca84275ca..4c6f6f9224 100644 --- a/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm +++ b/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm @@ -42,7 +42,9 @@ // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead - (NSUInteger) supportedInterfaceOrientations{ - return UIInterfaceOrientationMaskLandscape; +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif } - (BOOL) shouldAutorotate {