Search code examples
iosswiftuifontuiblureffect

Font type and color based on device


I have a UI that looks good on all iOS 8 devices I've tried so far except the iPad 3 - the blur effect doesn't work so my white text is hard to read. Is there a way I can change the color of that font just for that one device? (are there other iOS 8 compatible devices that don't have the blur effect?) Is this the best way to handle it?

thanks for any advice.


Solution

  • Usually it's done by defining behavior for each specific device. You can find out the device type in runtime:

    https://gist.github.com/Jaybles/1323251

    Example code:

    UIDeviceHardware *h=[[UIDeviceHardware alloc] init];
    if ( [h platformString] isEqualToString:@"iPhone4"] )
    {
            // don't use blur
    }
    

    As for which devices support blur, you can use code from here:

    How can I detect if an iOS device supports the blur effect?