objective c - iOS 8 UITableView rotation bug -
so after compiling app on xcode 6, noticed unusual bug happens when running on ios 8: uitableview
takes wrong inner dimensions after updating frame.
now i'll seek explain exact situation: have uitableview
rotated on side, makes horizontal uitableview
. happens through tableview.transform = cgaffinetransformmakerotation(-m_pi / 2);
. after setting transform, , settings frame - fine. of course of study scheme in cases sends parent frame alter because needs set parent real sizes , not xib sizes or initialization size. in moment - when relayout subviews, including table view - goes wrong. frame of table view set bounds
of containing view, inner scrollview (in ios 8 uitableview
has uiscrollview
within it, called uitableviewwrapperview
. uitableview
uiscrollview
itself, can't figure out why needed one...) takes "height" equals parent width. , "height" width
property, rotated.
now can estimate have bug relating width of inner uiscrollview
actual width of parent uitableview
, perchance reading .frame.size.width
instead of .bounds.size.width
. unusual thing when investigating frame of subviews of uitableview
- seems good! must rendering problem somewhere.
so left horizontal table has blank gap on top, because "height" of cells 320 instead of 568, while "width" of cells fine, set 320.
i'll happy hear other people experiencing problem (or apple), have found solution , posting here question, future reference me , others.
so alter made behave, instead of doing this:
- (void)layoutsubviews { tableview.frame = self.bounds; }
i have reset transform, set frame bounds uitableview expect locally after transform, , set transform , set right frame. bit confusing, here goes:
- (void)layoutsubviews { if (uidevice.currentdevice.systemversion.floatvalue >= 8.f) { // ios 8 layout bug! table's "height" taken "width" after changing frame. if cancel transform, set width/height final width/height, , rotate , set virtual width/height - works! cgrect rotatedframe = self.bounds, unrotatedframe = rotatedframe; unrotatedframe.size.width = rotatedframe.size.height; unrotatedframe.size.height = rotatedframe.size.width; tableview.transform = cgaffinetransformidentity; tableview.frame = unrotatedframe; tableview.transform = cgaffinetransformmakerotation(-m_pi / 2); tableview.frame = rotatedframe; } else { tableview.frame = self.bounds; } }
ios objective-c xcode ios8 xcode6
No comments:
Post a Comment