iOS Development Basics-fragmentation 24

Source: Internet
Author: User
<span id="Label3"></p><p><p><strong>1: compatible font size 6plue different from the following</strong></p></p><pre><pre><span style="color: #0000ff;">#define</span> Font_compatible_screen_offset (_fontsize_) [uifont systemfontofsize: (_fontsize_ * ([uiscreen MainScreen].scale) /2)]</pre></pre><p><p>In iphone4~6, the scaling factor scale=2; in iphone6+, the scaling factor scale=3</p></p><p><p>When Used:</p></p><pre><pre>Mylabel.font=font_compatible_screen_offset (<span style="color: #800080;"></span>a);</pre></pre><p><p>Extend: draw a single pixel of a macro</p></p><pre><pre><span style="color: #0000ff;">#define</span> Single_line_width (1/[uiscreen mainscreen].scale)<span style="color: #0000ff;">#define</span> single_line_adjust_offset ((1/[ UIScreen mainscreen].scale)/2)</pre></pre><p><p>When Used:</p></p><pre><pre><span style="color: #800080;">5</span> <span style="color: #000000;">; </span> <span style="color: #800080;">0</span> <span style="color: #800080;"></span>)];</pre></pre><p><p><strong>2: the<span class="s1">app virtual machine can run in the Real-computer debug times this issue because the product name is set to Chinese cause</span></strong></p></p><pre><pre><span style="color: #000000;"></span><span style="color: #0000ff;">Internal</span> <span style="color: #000000;">API Error. The product name of packaging in Build settings is set to Chinese</span></pre></pre><p><p><strong>3:xcode <span class="s1">certificate store path</span> </strong></p></p><pre><pre>Resource Pool/mobiledevice/provisioning Profiles</pre></pre><p><p><strong>4: <span class="s1">use Third-party rdvtabbarcontroller the bottom tab when you want to hide the animation off, there will be no flash of the situation</span></strong></p></p><pre><pre><span style="color: #008000;">//</span> <span style="color: #008000;">Hide Bottom menu</span> -(<span style="color: #0000ff;">void</span><span style="color: #000000;">) viewwillappear: (BOOL) animated { [super viewwillappear:animated]; [[self rdv_tabbarcontroller] Settabbarhidden:yes animated:no];}</span> -(<span style="color: #0000ff;">void</span><span style="color: #000000;">) viewwilldisappear: (BOOL) animated { [super viewwilldisappear:animated]; [[self rdv_tabbarcontroller] settabbarhidden:no animated:no];}</span></pre></pre><p><p><strong>5:<span class="s1">Masonry Some other content</span></strong></p></p><p class="p1"><p class="p1"><span class="s1">A:make.equalto or Make.greaterthanorequalto (up to) or Make.lessthanorequalto (at least)</span></p></p><pre><pre><span style="color: #000000;">make.left.greaterThanOrEqualTo (label); make.left.greaterThanOrEqualTo (label.mas_left);</span> <span style="color: #008000;">//</span> <span style="color: #008000;">width >= && width <=</span>make.width.greaterThanOrEqualTo (@<span style="color: #800080;"></span><span style="color: #000000;">); Make.width.lessThanOrEqualTo (@</span><span style="color: #800080;"></span>)</pre></pre><p class="p1"><p class="p1"><span class="s1">B:masequalto and Equalto differences: Masequalto is more than Equalto type conversion operations, generally speaking, most of the time two methods are common, but for numeric elements use Mas_equalto. For the handling of objects or multiple properties, use Equalto. In particular, multiple attributes must be used Equalto</span></p></p><p class="p1"><p class="p1"><span class="s1">C: Some simple assignment</span></p></p><pre><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">make <span style="color: #008000;">top = superview.top + 5, left = superview.left + ten,</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">bottom = superview.bottom-15, right = superview.right-20</span></span>Make.edges.equalTo (superview). insets (uiedgeinsetsmake (<span style="color: #800080;"><span style="color: #800080;">5</span></span>,<span style="color: #800080;"><span style="color: #800080;">Ten</span></span>,<span style="color: #800080;"><span style="color: #800080;"></span> the</span>,<span style="color: #800080;"><span style="color: #800080;"></span> -</span><span style="color: #000000;"><span style="color: #000000;">))</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">make <span style="color: #008000;">width and height greater than or equal to Titlelabel</span></span><span style="color: #000000;"><span style="color: #000000;">Make.size.greaterThanOrEqualTo (titlelabel)</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">make <span style="color: #008000;">width = superview.width +, height = superview.height-50</span></span>Make.size.equalTo (superview). Sizeoffset (cgsizemake (<span style="color: #800080;"><span style="color: #800080;"></span> -</span>, -<span style="color: #800080;"><span style="color: #800080;"></span> -</span><span style="color: #000000;"><span style="color: #000000;">))</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">make <span style="color: #008000;">CenterX = superview.centerx-5, centery = superview.centery +</span></span>Make.center.equalTo (superview). centeroffset (cgpointmake (-<span style="color: #800080;"><span style="color: #800080;">5</span></span>,<span style="color: #800080;"><span style="color: #800080;">Ten</span></span>))</pre><p><p>D:<span class="s1">use</span> of and keywords</p></p><pre><pre><span style="color: #000000;">Make.left.right.and.bottom.equalTo (superview); Make.top.equalTo (otherview);</span></pre></pre><p class="p1"><p class="p1"><span class="s1">E: priority; Priority (. Priority,.priorityhigh,.prioritymedium,.prioritylow)</span></p></p><pre><pre><span style="color: #000000;">'. priority ' allows you to specify an exact precedence '. Priorityhigh ' is equivalent to Uilayoutprioritydefaulthigh '. prioritymedium ' between high and low '. prioritylow ' Equivalent to Uilayoutprioritydefaultlow instance: make.left.greaterThanOrEqualTo (label.mas_left). with.prioritylow (); Make.top.equalTo (label.mas_top). with.priority (</span><span style="color: #800080;"></span>+);</pre></pre><p><p>G: <span class="s1">Once you have created constraint with mas_makeconstraints, you can use a local variable or property to save it for the next reference, and if you create multiple constraints, you can save them with an array</span></p></p><pre><pre><span style="color: #008000;">//</span> <span style="color: #008000;">local or global</span> @property (nonatomic, strong) masconstraint *<span style="color: #000000;">topconstraint;</span> <span style="color: #008000;">//</span> <span style="color: #008000;">Create a constraint and assign a value</span> [view1 mas_makeconstraints:^ (masconstraintmaker * make<span style="color: #000000;">) { </span>=<span style="color: #000000;"> make.top.equalTo (superview.mas_top). With.offset (padding.top); Make.left.equalTo (superview.mas_left). with.offset (padding.left);}];</span> <span style="color: #008000;">//</span> <span style="color: #008000;">Direct access to the Self.topconstraint after</span> [self.topconstraint uninstall];</pre></pre><p class="p1"><p class="p1"><span class="s1">H:mas_updateconstraints Update constraints, Sometimes you need to update constraint (for example, animation and Debugging) instead of creating a fixed constraint, you can use the Mas_updateconstraints method</span></p></p><pre><pre>-(<span style="color: #0000ff;">void</span><span style="color: #000000;">) updateconstraints { [self.growingbutton mas_updateconstraints:</span>^ (masconstraintmaker * make <span style="color: #000000;">) { Make.center.equalTo (self); Make.width.equalTo (@ (self.buttonSize.width)). prioritylow (); Make.height.equalTo (@ (self.buttonSize.height)). prioritylow (); Make.width.lessThanOrEqualTo (self); Make.height.lessThanOrEqualTo (self); }]; </span> <span style="color: #008000;">//</span> <span style="color: #008000;">Call Parent Updateconstraints</span> <span style="color: #000000;"> [super updateconstraints];}</span></pre></pre><p class="p1"><p class="p1"><span class="s1">I:mas_remakeconstraints update constraints, mas_remakeconstraints and mas_updateconstraints are similar, are updated Constraint. however, Mas_remakeconstraints is to delete the constraint before adding a new constraint (for mobile animations), and mas_updateconstraints just updates the value of Constraint.</span></p></p><pre><pre>-(<span style="color: #0000ff;">void</span><span style="color: #000000;">) changebuttonposition { [self.button mas_remakeconstraints:</span>^ (masconstraintmaker * <span style="color: #000000;"> Make) { make.size.equalTo (self.buttonsize); </span> <span style="color: #0000ff;">if</span> <span style="color: #000000;">(topleft) { make.top.and.left.offset (</span><span style="color: #800080;">ten</span><span style="color: #000000;">); </span> <span style="color: #0000ff;">Else</span> <span style="color: #000000;">{ Make.bottom.and.right.offset (</span>-<span style="color: #800080;">ten</span><span style="color: #000000;">); } }];}</span></pre></pre><p><p></p></p><p><p>iOS Development Basics-fragmentation 24</p></p></span>

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.