Introduction of a Bug/masonry

Source: Internet
Author: User

Support iOS 6/6 plus when you encounter such a problem: plug in the UITableViewCell in the center of the Uipagecontrol set failed, right just set the current breakpoint view (6Plus Simulator): <graypagecontrol: 0x7f96a535c350; BaseClass = Uipagecontrol; frame = (179.5 241.75; 55 6); AutoResize = W; Layer = <CALayer:0x7f96a535c4a0>> after run:<graypagecontrol:0x7f96a535c350; BaseClass = Uipagecontrol; frame = (179.333 241.75; 149 6); AutoResize = W; Layer = <CALayer:0x7f96a535c4a0>> When curiosity is changed, consider making a memory modification breakpoint, LLDB, listen to the advice to detect calayer frame changes instead of 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 ' $x 0 = = 0x174c38500 '
Breakpoint 113:where = Quartzcore '-[calayer setbounds:], address = 0x000000018a3eb93c The result is layoutsubviews:
#0 0x000000018a3eb93c inch-[Calayer SetBounds:] () #1 0x000000018a3ec684 inch-[Calayer Setframe:] () #2 0x000000018aa9da3c inch-[UIView (Geometry) Setframe:] () #3 0X000000018AABA7B4 inch-[UIView (Geometry) _applyautoresizingmaskwitholdsuperviewsize:] () #4 0x000000018618cfc8 inch__53-[__nsarraym Enumerateobjectswithoptions:usingblock:]_block_invoke () #5 0x000000018618ce6c inch-[__nsarraym Enumerateobjectswithoptions:usingblock:] () #6 0x000000018aaa9f58 inch-[UIView (Geometry) Resizesubviewswitholdsize:] () #7 0X000000018AA9DAF4 inch-[UIView (Geometry) Setframe:] () #8 0x000000018ab7b9d4 inch-[Uitableviewcellcontentview Setframe:] () #9 0x000000018abe442c inch__53-[UITableView _configurecellfordisplay:forindexpath:]_block_invoke () #Ten 0x000000018aab24c8 inch+[UIView (Animation) Performwithoutanimation:] () # One 0x000000018abe3b0c inch-[UITableView _configurecellfordisplay:forindexpath:] () # A 0x000000018ad9b4d8 inch-[UITableView _createpreparedcellforglobalrow:withindexpath:willdisplay:] () # - 0x000000018ad9006c inch-[UITableView _updatevisiblecellsnow:isrecursive:] () # - 0x000000018ab84c44 inch-[UITableView Layoutsubviews] () # the 0x000000018aaa14a4 inch-[UIView (Calayerdelegate) Layoutsublayersoflayer:] () # - 0x000000018a3f57a8 inch-[Calayer Layoutsublayers] () # - 0x000000018a3f0378 inchCa::layer::layout_if_needed (ca::transaction*) ()# - 0x000000018a3f021c inchCa::layer::layout_and_display_if_needed (ca::transaction*) ()# + 0x000000018a3efa14 inchCa::context::commit_transaction (ca::transaction*) ()# - 0x000000018a3ef798 inchCa::transaction::commit () () # + 0x000000018a3e91c8 inchCa::transaction::observer_callback (__cfrunloopobserver*, unsignedLong,void*) ()# A 0x000000018624ed98 inch__cfrunloop_is_calling_out_to_an_observer_callback_function__ () # at 0x000000018624bd24 inch__cfrunloopdoobservers () # - 0x000000018624c104 inch__cfrunlooprun () # - 0x00000001861791f4 inchcfrunlooprunspecific () # - 0X000000018F59B6FC inchGseventrunmodal () # - 0x000000018ab0a10c inchUiapplicationmain () # - 0x0000000100029ce0 inchMain

Take a look at the assignment process: (LLDB) po $x 0
<CALayer:0x174c38500; Position = Cgpoint (215 220.375); Bounds =CGRect (0 0; 6); Delegate = <GrayPageControl:0x15fe26ca0; BaseClass = Uipagecontrol; frame = (187.5 217.375; 55 6); AutoResize = W; Layer = <CALayer:0x174c38500>>; Sublayers = (<calayer:0x170a3fd40>, <calayer:0x1704250a0>, <calayer:0x174c38200>, <CALayer: 0x174c38080>); opaque = YES; allowsgroupopacity = YES; > (LLDB) Finish (LLDB) PO 0x174c38500<CALayer:0x174c38500; Position = Cgpoint (215 220.375); Bounds =CGRect (0 0; 6); Delegate = <GrayPageControl:0x15fe26ca0; BaseClass = Uipagecontrol; frame = (160 217.375; 110 6); AutoResize = W; Layer = <CALayer:0x174c38500>>; Sublayers = (<calayer:0x170a3fd40>, <calayer:0x1704250a0>, <calayer:0x174c38200>, <CALayer: 0x174c38080>); opaque = YES; allowsgroupopacity = YES; > Here borrowed an iphone 6/ios8, CPU is ARM64 so you have to refer to the following link Bcattle supplementary answer, register is $x0, iphone 5/ios7 with $r0 but incredibly value did not change. The simulator did not succeed. In addition, the former is Layoutsubviews UITableView, and the latter is called by UITableViewCell. Http://stackoverflow.com/questions/13976219/how-do-i-set-an-lldb-watchpoint-on-a-property-of-self-view Curious Satisfied, Then find a way to solve it. So on the search Pagecontrol UITableViewCell layoutsubviews/center and so on, did not see the relevant discussion. One day to learn a little AutoLayout hurriedly come to write a line:
1 [PC Settranslatesautoresizingmaskintoconstraints:no];2 [Cell.contentview addconstraints:[nslayoutconstraint3Constraintswithvisualformat:@"h:|-0-[pc]-0-| "4 options:05 Metrics:nil6 views:nsdictionaryofvariablebindings (PC)];7  8 [Cell.contentview addconstraints:[nslayoutconstraint9 constraintswithvisualformat:[nsstring stringWithFormat: @"v:|-%f-[pc]- One-|", Cgrectgetheight (scroll.frame) -11-6]TenOptions0  One Metrics:nil AViews:nsdictionaryofvariablebindings (PC)];

Not suspense, success. So the conclusion came out, AutoLayout upgrade to compulsory. Masonry, here I come.

1 [PC mas_makeconstraints:^ (Masconstraintmaker * make ) {2     make.bottom.equalTo ( Cell.contentView.mas_bottom). With.offset (-6); 3     Make.centerX.equalTo (Cell.contentView.mas_centerX); 4 }];

Epilogue: Will the storyboard preview feature +sizeclass a bit faster than the traditional hand code? 2015.03.30

Introduction of a Bug/masonry

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.