Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compatibility with automaticallyAdjustsScrollViewInsets

I've been working a little with the new UI options in iOS 7, and the automaticallyAdjustsScrollViewInsets property in UIViewController is really freaking me out. the thing is, either you don't set it, but then you will have to position your scroll views differently in iOS 7 and other iOS versions. the alternative is to set it to NO only for iOS 7 and use the same positioning. I don't understand why apple implemented this property at all, in my opinion, good practice would be always having it to NO (not having such a property at all), just like it was before. I understand that it is easier to use if you are lazy, but this seems like a really bad programming practice in my opinion. am I missing out on something or do you agree?

like image 638
haag Avatar asked Feb 15 '23 09:02

haag


1 Answers

I don't see any problem. iOS 6 SDK does not contain this property. You just should use following code:

if([self respondsToSelector:@selector(setAutomaticallyAdjustsScrollViewInsets:)])
{
   self.automaticallyAdjustsScrollViewInsets = NO;
}
like image 70
Sviatoslav Yakymiv Avatar answered Feb 17 '23 02:02

Sviatoslav Yakymiv