关闭

一个Bug/Masonry的引入

发表于:2015-4-24 10:55

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:kurk    来源:51Testing软件测试网采编

  支持iOS 6/6 Plus的时候碰到这样一个问题:
  塞在UITableViewCell里的UIPageControl居中设置失败了,偏右
  刚刚设置时下断点查看(6Plus模拟器):
  <GrayPageControl: 0x7f96a535c350; baseClass = UIPageControl; frame = (179.5 241.75; 55 6); autoresize = W; layer = <CALayer: 0x7f96a535c4a0>>
  运行后:
  <GrayPageControl: 0x7f96a535c350; baseClass = UIPageControl; frame = (179.333 241.75; 149 6); autoresize = W; layer = <CALayer: 0x7f96a535c4a0>>
  好奇在什么时候被改变的,考虑搞个内存修改断点,上lldb,听从忠告检测CALayer的frame改动而不是UIView的:
  (lldb) po pc
  <GrayPageControl: 0x15fe26ca0; baseClass = UIPageControl; frame = (160 217.375; 55 6); autoresize = W; layer = <CALayer: 0x174c38500>>
  (lldb) break set -F '-[CALayer setBounds:]' -c '$x0 == 0x174c38500'
  Breakpoint 113: where = QuartzCore`-[CALayer setBounds:], address = 0x000000018a3eb93c
  结果是 layoutSubviews:
#0 0x000000018a3eb93c in -[CALayer setBounds:] ()
#1 0x000000018a3ec684 in -[CALayer setFrame:] ()
#2 0x000000018aa9da3c in -[UIView(Geometry) setFrame:] ()
#3 0x000000018aaba7b4 in -[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] ()
#4 0x000000018618cfc8 in __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke ()
#5 0x000000018618ce6c in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] ()
#6 0x000000018aaa9f58 in -[UIView(Geometry) resizeSubviewsWithOldSize:] ()
#7 0x000000018aa9daf4 in -[UIView(Geometry) setFrame:] ()
#8 0x000000018ab7b9d4 in -[UITableViewCellContentView setFrame:] ()
#9 0x000000018abe442c in __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke ()
#10 0x000000018aab24c8 in +[UIView(Animation) performWithoutAnimation:] ()
#11 0x000000018abe3b0c in -[UITableView _configureCellForDisplay:forIndexPath:] ()
#12 0x000000018ad9b4d8 in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] ()
#13 0x000000018ad9006c in -[UITableView _updateVisibleCellsNow:isRecursive:] ()
#14 0x000000018ab84c44 in -[UITableView layoutSubviews] ()
#15 0x000000018aaa14a4 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#16 0x000000018a3f57a8 in -[CALayer layoutSublayers] ()
#17 0x000000018a3f0378 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#18 0x000000018a3f021c in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#19 0x000000018a3efa14 in CA::Context::commit_transaction(CA::Transaction*) ()
#20 0x000000018a3ef798 in CA::Transaction::commit() ()
#21 0x000000018a3e91c8 in CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) ()
#22 0x000000018624ed98 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#23 0x000000018624bd24 in __CFRunLoopDoObservers ()
#24 0x000000018624c104 in __CFRunLoopRun ()
#25 0x00000001861791f4 in CFRunLoopRunSpecific ()
#26 0x000000018f59b6fc in GSEventRunModal ()
#27 0x000000018ab0a10c in UIApplicationMain ()
#28 0x0000000100029ce0 in main
21/212>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号