Re: After popping view controller, table view scrolls sideways
Re: After popping view controller, table view scrolls sideways
- Subject: Re: After popping view controller, table view scrolls sideways
- From: Roland King <email@hidden>
- Date: Fri, 16 Aug 2013 23:30:01 +0800
Here's mine, right from the source (note I only have one section in this table so rectForSection: works fine), the code is 'first do no evil' code so it just blocks incorrect sizes and does nothing, just letting the correct ones through.
The motivation for this particularly vile piece of code came from logging where the content size was being set and finding it was set correctly and then reset by some tail method of autolayout which had a very hacky smell about it, scrollviews and autolayout co-exist very unpeacefully at the best of times, I think the code turned one edge case into another.
I have a few versions of this depending on what it takes to figure out the correct content size in the given case, but the plan is always the same, assume autolayout is making a mess and check it against what I know to be correct. I've come across this bug quite often.
-(void)setContentSize:(CGSize)contentSize
{
// autolayout just breaks everything, ignore any change to the content size
// which is incompatible with the size of the section, which is the real content size
CGSize realContentSize = [ self rectForSection:0 ].size;
if( CGSizeEqualToSize( realContentSize, contentSize ) )
[ super setContentSize:contentSize ];
}
On 16 Aug, 2013, at 7:14 PM, Rick Mann <email@hidden> wrote:
>
> On Aug 16, 2013, at 04:12 , Roland King <email@hidden> wrote:
>
>> That's probably it then. Can't tell you the fix as I'm I'm the arse end of nowhere using a phone for mail.
>
> Hehe, no worries.
>
>> Basically auto layout gets it right then calls a method which resets the content size to what it was before, I know not why. I have a method somewhere which catches this content size change and thwarts it if it's not the bounds size. Hack.
>
> Ugh, yeah. Okay, I'll probably do that. You just override -setContentSize:? Or check it when the view is popped?
>
> --
> Rick
>
>>
>>> On 16 Aug, 2013, at 19:05, Rick Mann <email@hidden> wrote:
>>>
>>>
>>>> On Aug 16, 2013, at 04:04 , Roland King <email@hidden> wrote:
>>>>
>>>> Auto layout for this project? I've had loads of issues with scroll views resizing themselves badly under auto layout. I have a hack I use for it but it's on my box at home.
>>>
>>> Yep, autolayout.
>>>
>>> --
>>> Rick
>>>
>>>
>>>
>
>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden