How does 'appearanceWhenContainedInInstancesOfClasses' work?

Hey guys,


as 'appearanceWhenContainedIn' is deprecated in iOS 9 and should be replaced with 'appearanceWhenContainedInInstancesOfClasses' I want to tweak my code to that effect. But how to do that? I didn't find something in the official documentation. ATM, my code looks like this:

[[UIScrollView appearanceWhenContainedIn:[UITableView class], nil] setBackgroundColor:[UIColor whiteColor]];

How do I rewrite this snippet for iOS 9 using 'appearanceWhenContainedInInstancesOfClasses'? Thanks in advance! 🙂


Alex

Answered by Poets in 10181022

I figured out the solution:

[[UIScrollView appearanceWhenContainedInInstancesOfClasses:@[[UITableView class]]]
                                        setBackgroundColor:[UIColor whiteColor]];

I just didn't notice that you have to pass an array as parameter when using appearanceWhenContainedInInstancesOfClasses. 😁

All the best,

Alex

Accepted Answer

I figured out the solution:

[[UIScrollView appearanceWhenContainedInInstancesOfClasses:@[[UITableView class]]]
                                        setBackgroundColor:[UIColor whiteColor]];

I just didn't notice that you have to pass an array as parameter when using appearanceWhenContainedInInstancesOfClasses. 😁

All the best,

Alex

How does 'appearanceWhenContainedInInstancesOfClasses' work?
 
 
Q