-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recalculate contentOffset for device rotation #156
base: master
Are you sure you want to change the base?
Recalculate contentOffset for device rotation #156
Conversation
Thanks for your contribution. I have a strong feeling that code like this is very useful, but shall live within the view controller. Bounds changing do not necessary reflect layout orientation change, as in the grid view might scale only in one direction. This code introduces too much unexpected behavior for my taste. We might benefit from putting this in a sample project instead of in the grid view itself. Another idea is to add a flag on the grid view that handles this special case. I’ll be closing this issue for now but feel free to re-open it to discuss. Thanks again! |
Hi Evadne, I'm not sure my submission comments got the point across. The AQGridView "Bounds changing _do not necessary *reflec_t* layout orientation change," Someone with more experience or knowledge of the AQGridView's code base It seems to me that if you refuse to fix this behavior inside the class you How about reopening this and we discuss a better way to make the fix Walter On Fri, Sep 14, 2012 at 9:40 PM, Evadne Wu [email protected] wrote:
|
@evadne @whatcher2 @AlanQuatermain Yeah, I find this reason for closure questionable. I can understand, e.g., wanting to be pure regarding Controller/View division of labor, if the existing classes already exhibited that purity; by my reading they don't. But, even if by your measure, they do, a helpful reply would suggest where in the controller the fix might go, and why, and leave the request open. The sample code suggestion (for a bug fix) seems just whack. Please reconsider. |
Sorry — my fault in not communicating clearly. Showing some other cells, while at the same time maintaining offset, is certainly bad user experience and will nevertheless require code either inside or outside the project to handle. The original goals of the project is to match NSCollectionView as much as possible. It conflicts with optimizing for developer happiness. For a very quick testing, iBooks exhibits the same behavior on device rotation — it shows a different set of cells. The Photos app on iPad handles this case better, but I fail to find any app where, after rotating to and back from a certain orientation, the grid view shows the same set of cells. For example, go to Photos.app, open the Photo Stream, go landscape, navigate to the last row and scroll one row downwards. Now rotate to portrait. The app should show the last photo on the last row. Rotate back to landscape and the grid view now shows the last cell as well. Judging from code and how the sample app runs, we’ll get the behavior that Photos.app show in AQGridView. As an additional example why a simple fit-to-bottom or fit-to-displayed-index-paths will sometimes fail, enable the Emoji keyboard on the iPhone, then go to any app that supports landscape input. Scroll to the last page in the segment, then start rotating the device to landscape and back. You end up on the first page of the segment. The desired behavior is not consistently handled even across iOS apps and it’s important for it to be well-defined. However, it’s always okay for AQGridView to have its own idiosyncrasy — as long as it is very reasonably documented — and I surely have made a judgmental mistake of rejecting a patch for a certain defect. I’d like to pull this into develop shortly, test on demo, internal and public projects, and wait for community feedback. Thanks again for your feedback. |
Sounds great, thanks! For what its worth iBooks as you described it sounds broken to me. Apple Interestingly enough the problem does not manifest at all with the current Thanks again. On Mon, Sep 17, 2012 at 2:15 PM, Evadne Wu [email protected] wrote:
|
On very large tables with different layouts in portrait/landscape like 3x4/4x3 the total grid height can be very different so its necessary to change the contentOffset proportionally. This keeps the current cells in view (as much as possible). Before making any calculations the cell size needs to be fetched to handle cases when its height differs between portrait and landscape.