Merge pull request #1400 from walzer/gles20

fix compilation error in xcodebuild command line mode, which are caused by ios6 compatibility
This commit is contained in:
Walzer 2012-09-26 19:29:53 -07:00
commit bfa71ebdf5
9 changed files with 39 additions and 23 deletions

View File

@ -118,18 +118,17 @@
} }
size.width = MIN(size.width, origSize.width); size.width = MIN(size.width, origSize.width);
// adjust the point for alignment // adjust the point for alignment
switch ((NSTextAlignment)self.textAlignment) { switch (self.textAlignment) {
case NSTextAlignmentLeft: case UITextAlignmentLeft:
break; break;
case NSTextAlignmentCenter: case UITextAlignmentCenter:
point.x += (origSize.width - size.width) / 2.0f; point.x += (origSize.width - size.width) / 2.0f;
break; break;
case NSTextAlignmentRight: case UITextAlignmentRight:
point.x += origSize.width - size.width; point.x += origSize.width - size.width;
break; break;
case NSTextAlignmentJustified: default:
case NSTextAlignmentNatural: break;
default: break;
} }
[self.text drawAtPoint:point forWidth:size.width withZFont:actualFont lineBreakMode:self.lineBreakMode]; [self.text drawAtPoint:point forWidth:size.width withZFont:actualFont lineBreakMode:self.lineBreakMode];
} else { } else {

View File

@ -637,19 +637,18 @@ static CGSize drawOrSizeTextConstrainedToSize(BOOL performDraw, NSString *string
// draw // draw
if (performDraw) { if (performDraw) {
switch ((NSTextAlignment)alignment) { switch (alignment) {
case NSTextAlignmentLeft: case UITextAlignmentLeft:
drawPoint.x = 0; drawPoint.x = 0;
break; break;
case NSTextAlignmentCenter: case UITextAlignmentCenter:
drawPoint.x = (constrainedSize.width - lineSize.width) / 2.0f; drawPoint.x = (constrainedSize.width - lineSize.width) / 2.0f;
break; break;
case NSTextAlignmentRight: case UITextAlignmentRight:
drawPoint.x = constrainedSize.width - lineSize.width; drawPoint.x = constrainedSize.width - lineSize.width;
break; break;
case NSTextAlignmentJustified: default:
case NSTextAlignmentNatural: break;
default: break;
} }
NSUInteger stopGlyphIdx = glyphIdx; NSUInteger stopGlyphIdx = glyphIdx;
NSUInteger lastRunIdx = currentRunIdx; NSUInteger lastRunIdx = currentRunIdx;

View File

@ -57,15 +57,21 @@
return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsLandscape( interfaceOrientation );
} }
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead // For ios6.0 and higher, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{ - (NSUInteger) supportedInterfaceOrientations
return UIInterfaceOrientationMaskLandscape; {
#ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
} }
- (BOOL) shouldAutorotate { - (BOOL) shouldAutorotate {
return YES; return YES;
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview. // Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];

View File

@ -59,7 +59,9 @@
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{ - (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape; #ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
} }
- (BOOL) shouldAutorotate { - (BOOL) shouldAutorotate {

View File

@ -59,7 +59,9 @@
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{ - (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape; #ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
} }
- (BOOL) shouldAutorotate { - (BOOL) shouldAutorotate {

View File

@ -42,7 +42,9 @@
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{ - (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape; #ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
} }
- (BOOL) shouldAutorotate { - (BOOL) shouldAutorotate {

View File

@ -42,7 +42,9 @@
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{ - (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape; #ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
} }
- (BOOL) shouldAutorotate { - (BOOL) shouldAutorotate {

View File

@ -59,7 +59,9 @@
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{ - (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape; #ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
} }
- (BOOL) shouldAutorotate { - (BOOL) shouldAutorotate {

View File

@ -42,7 +42,9 @@
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{ - (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape; #ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
} }
- (BOOL) shouldAutorotate { - (BOOL) shouldAutorotate {