Search code examples
iosuitableviewios7uipopovercontroller

How to make the view background transparent only if the view is used inside an iOS 7 popover?


The iOS 7 HIG says:

(By default, table views, navigation bars, and toolbars in a popover use a transparent background to let the popover’s blurring show through.)

What is the recommended way to replicate this behavior of the table view (white background on iOS 6 and/or when not in a popover, transparent when in an iOS 7 popover) for my custom views?


Solution

  • Its simple just set the UITableView background for iOS 6 to white and for iOS 7 make it clear

    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
       // Load resources for iOS 6.1 or earlier
    } else if (isPresentedWithPopOver) {
       // Load resources for iOS 7 or later
    } else {
       // Load resources for iOS 7 or later
    }