Search code examples
iphoneobjective-cios4iphone-sdk-3.0landscape

EGOTableViewPullRefresh and landscape orientation


I am using Cocoanetic's implementation of EGOTableViewPullRefresh.
It's a cinch to implement. Love it:

The only problem I'm having is with rotation. When the view rotates, the refresh header doesn't adjust for landscape mode. It sits left aligned, 320.0f units wide.

enter image description here

I have tried everything I can think of to adjust this properly. I set it as a property in PullToRefreshTableViewController and tried to set the frame the same way it is done in init. This failed. I tried to do it in this same controller in viewWillAppear. Failed.

Beyond this, I tried about 6 other methods not worth detailing. The problem seems to be that I'm using the wrong bounds, even though I'm making them relative to the view.

Nothing I do replicates what is seemingly easy in viewDidLoad:

refreshHeaderView = [[EGORefreshTableHeaderView alloc] initWithFrame:
                         CGRectMake(0.0f, 0.0f - self.view.bounds.size.height,
                                    320.0f, self.view.bounds.size.height)];

It seems all I really need to do is increase the width. I tried something along the lines of this:

refreshHeaderView.frame = CGRectMake(refreshHeaderView.frame.origin.x, refreshHeaderView.frame.origin.y, 480.0f, refreshHeaderView.frame.size.height);  

No luck.

The link at the top has the full, unmodified source code for what I'm using.


Solution

  • What about just setting the UIView.autoresizingMask to UIViewAutoresizingFlexibleWidth?