@@ -74,7 +74,7 @@ - (void)createViews
74
74
// Determine whether rotation should be enabled for this device
75
75
// Per iOS HIG, landscape is only supported on iPad and iPhone 6+
76
76
CDV_iOSDevice device = [self getCurrentDevice ];
77
- BOOL autorotateValue = (device.iPad || device.iPhone6Plus ) ?
77
+ BOOL autorotateValue = (device.iPad || device.iPhone6Plus || device. iPhoneX ) ?
78
78
[(CDVViewController *)self .viewController shouldAutorotateDefaultValue ] :
79
79
NO ;
80
80
@@ -174,6 +174,7 @@ - (CDV_iOSDevice) getCurrentDevice
174
174
// this is appropriate for detecting the runtime screen environment
175
175
device.iPhone6 = (device.iPhone && limit == 667.0 );
176
176
device.iPhone6Plus = (device.iPhone && limit == 736.0 );
177
+ device.iPhoneX = (device.iPhone && limit == 812.0 );
177
178
178
179
return device;
179
180
}
@@ -222,8 +223,12 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
222
223
imageName = [imageName stringByAppendingString: @" -700" ];
223
224
} else if (device.iPhone6 ) {
224
225
imageName = [imageName stringByAppendingString: @" -800" ];
225
- } else if (device.iPhone6Plus ) {
226
- imageName = [imageName stringByAppendingString: @" -800" ];
226
+ } else if (device.iPhone6Plus || device.iPhoneX ) {
227
+ if (device.iPhone6Plus ) {
228
+ imageName = [imageName stringByAppendingString: @" -800" ];
229
+ } else {
230
+ imageName = [imageName stringByAppendingString: @" -1100" ];
231
+ }
227
232
if (currentOrientation == UIInterfaceOrientationPortrait || currentOrientation == UIInterfaceOrientationPortraitUpsideDown)
228
233
{
229
234
imageName = [imageName stringByAppendingString: @" -Portrait" ];
@@ -239,7 +244,7 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
239
244
{ // does not support landscape
240
245
imageName = [imageName stringByAppendingString: @" -667h" ];
241
246
}
242
- else if (device.iPhone6Plus )
247
+ else if (device.iPhone6Plus || device. iPhoneX )
243
248
{ // supports landscape
244
249
if (isOrientationLocked)
245
250
{
@@ -257,8 +262,11 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i
257
262
break ;
258
263
}
259
264
}
260
- imageName = [imageName stringByAppendingString: @" -736h" ];
261
-
265
+ if (device.iPhoneX ) {
266
+ imageName = [imageName stringByAppendingString: @" -2436h" ];
267
+ } else {
268
+ imageName = [imageName stringByAppendingString: @" -736h" ];
269
+ }
262
270
}
263
271
else if (device.iPad )
264
272
{ // supports landscape
@@ -370,7 +378,7 @@ - (void)updateBounds
370
378
* correctly.
371
379
*/
372
380
CDV_iOSDevice device = [self getCurrentDevice ];
373
- if (UIInterfaceOrientationIsLandscape (orientation) && !device.iPhone6Plus && !device.iPad )
381
+ if (UIInterfaceOrientationIsLandscape (orientation) && !device.iPhone6Plus && !device.iPad && !device. iPhoneX )
374
382
{
375
383
imgTransform = CGAffineTransformMakeRotation (M_PI / 2 );
376
384
imgBounds.size = CGSizeMake (imgBounds.size .height , imgBounds.size .width );
0 commit comments