Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 25
    This isn't a good practice at all, I highly discourage to use this method since this UIView is private. I am curious to see if your app gets approved using this. Commented Dec 13, 2016 at 23:06
  • @iGranDav Why isn't this good practice. The method value(forKey key: String) is open so I'm assuming its ok to use. Can you please explain. If this is bad practice, how would you change the background color or the status bar. This methd has worked for me. I've tried adding a subview to the window object in the AppDelegate and that didn't work. Commented Dec 21, 2016 at 23:30
  • 4
    @breaktop using the value(forKey key: String) method you are using the KVC of objc runtime to access a view you shouldn't have access to (and has no documentation referring to it BTW) during runtime only. This construction is used under iOS 10 but not under iOS 9 for instance (where you need to access the statusBarWindow first), and you have absolutely no clue that it will persists under iOS 11. Internal construction and no docs means that Apple does not have any contract to respect here. Commented Dec 26, 2016 at 10:23
  • 6
    @SanketBhavsar I have not faced a rejection for using it as of yet Commented Mar 29, 2018 at 11:08
  • 2
    I have problem with this method on iPhone X. The background color becomes transparent when app switcher (home indicator) gesture is activated. Commented Apr 16, 2018 at 15:31