Skip to content

Commit 6e84189

Browse files
committed
Use UIDevice.currentDevice.userInterfaceIdiom for checking for iPad devices.
1 parent bfeafcc commit 6e84189

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

SimulatorStatusMagic/ViewController.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,7 @@ - (void)setDateStringTextFieldText
144144
- (void)setDateFieldVisibility
145145
{
146146
// Only show the date field on iPad devices as the date is never shown on iPhone devices.
147-
// Note: Trait collections can't be used here as not all iPhones are compact.
148-
// Note: Also, getenv() needs to be used instead of uname() to get the device information on the simulator.
149-
150-
NSString *deviceName = [NSString stringWithCString:getenv("SIMULATOR_MODEL_IDENTIFIER") encoding:NSUTF8StringEncoding];
151-
BOOL dateFieldHidden = [deviceName rangeOfString:@"iPad"].location == NSNotFound;
147+
BOOL dateFieldHidden = UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad;
152148
self.dateStringLabel.hidden = dateFieldHidden;
153149
self.dateStringTextField.hidden = dateFieldHidden;
154150
}

0 commit comments

Comments
 (0)