objective c - Second Screen display rotated 90 degrees in iOS 8.3 & 8.4 -
my question less of how fix issue , more of why happening:
starting in ios 8.3, when displaying videos on second screen (through either airplay or lightning -> hdmi) screen rotated 90ยบ. isn't problem on previous versions of ios or when app launched in portrait instead of landscape.
i've created workaround checking ios version , screen rotation , rotating view second window. in case else has problem, here's solution:
if ([[uidevice currentdevice].systemversion floatvalue] >= 8.3f) { cgfloat width = (_externalwindow.frame.size.width > _externalwindow.frame.size.height) ? _externalwindow.frame.size.width : _externalwindow.frame.size.height; cgfloat height = (_externalwindow.frame.size.width < _externalwindow.frame.size.height) ? _externalwindow.frame.size.width : _externalwindow.frame.size.height; cgrect rotatedframe = cgrectmake(0.0f, 0.0f, width, height); _externalwindow.frame = rotatedframe; if ([uidevice currentdevice].orientation == uideviceorientationlandscapeleft && [[uidevice currentdevice].systemversion floatvalue] < 9.0f) { cgaffinetransform transform = cgaffinetransformmakerotation(m_pi_2 * 3); _externalwindow.transform = transform; } else if ([uidevice currentdevice].orientation == uideviceorientationlandscaperight && [[uidevice currentdevice].systemversion floatvalue] < 9.0f) { cgaffinetransform transform = cgaffinetransformmakerotation(m_pi_2); _externalwindow.transform = transform; } }
edit: tested on ios 9 , found interesting problem that's similar previous problem. orientation displaying correctly frame still rotated part of content showing. adjusted solution make sure window frame oriented widescreen.
just know, able solve allowing portrait on vc:
-(nsuinteger)supportedinterfaceorientations { return uiinterfaceorientationmaskportrait; }
Comments
Post a Comment