iOS Development Basics-Fragmentation 24

Source: Internet
Author: User

1: Compatible font size 6plue different from the following

#define FONT_COMPATIBLE_SCREEN_OFFSET (_fontsize_)  [Uifont systemfontofsize: (_fontsize_ * ([UIScreen MainScreen] . scale)/2)]

In iphone4~6, the scaling factor scale=2; in iphone6+, the scaling factor scale=3

When used:

Mylabel.font=font_compatible_screen_offset (15);

Extend: Draw a single pixel of a macro

#define Single_line_width           (1/[UIScreen mainscreen].scale) #define Single_line_adjust_offset   ((1/[UIScreen Mainscreen].scale)/2)

When used:

CGFloat xPos = 5;    UIView *view = [[UIView alloc] Initwithframe:cgrect (x-single_line_adjust_offset, 0, Single_line_width, 100)];

2: Theapp virtual machine can run in the real-computer debug times this issue because the product name is set to Chinese cause

APP installation Failedthere is an internal API error. The product name of packaging in Build settings is set to Chinese

3:xcode certificate store path

Resource Pool/mobiledevice/provisioning Profiles

4: using third-party rdvtabbarcontroller at the bottom tab

To turn off the animation when you hide it, there's no flash.

Hide Bottom Menu-(void) Viewwillappear: (BOOL) animated {    [Super viewwillappear:animated];    [[Self Rdv_tabbarcontroller] settabbarhidden:yes animated:no];} -(void) Viewwilldisappear: (BOOL) animated {    [Super viewwilldisappear:animated];    [[Self Rdv_tabbarcontroller] settabbarhidden:no animated:no];}

5:Masonry Some other content

A:make.equalto or Make.greaterthanorequalto (up to) or make.lessthanorequalto (at least)

Make.left.greaterThanOrEqualTo (label); Make.left.greaterThanOrEqualTo (label.mas_left);//width >= && Width <= 400make.width.greaterthanorequalto (@200); Make.width.lessThanOrEqualTo (@400)

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

C: Some simple assignment

Make top = Superview.top + 5, left = Superview.left + 10,//bottom = superview.bottom-15, right = Superview.right-2 0make.edges.equalto (Superview). Insets (Uiedgeinsetsmake (5, ten, +))/make width and height greater than or equal to TI TleLabelmake.size.greaterThanOrEqualTo (Titlelabel)//Make width = superview.width +, height = superview.height-50ma Ke.size.equalTo (Superview). Sizeoffset (Cgsizemake ( -50))//Make CenterX = superview.centerx-5, CenterY = Superview.centery + 10make.center.equalto (superview). Centeroffset (Cgpointmake (-5, 10))

D:use of and keywords

Make.left.right.and.bottom.equalTo (Superview); Make.top.equalTo (Otherview);

E: Priority; priority (. Priority,.priorityhigh,.prioritymedium,.prioritylow)

'. 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 (600);

G: 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

Local or global @property (nonatomic, strong) Masconstraint *topconstraint;//create constraints and assign values [View1 mas_makeconstraints:^ ( Masconstraintmaker *make) {    self.topconstraint = Make.top.equalTo (superview.mas_top). With.offset (padding.top);    Make.left.equalTo (Superview.mas_left). With.offset (padding.left);}];/ /later can be directly accessed Self.topconstraint[self.topconstraint uninstall];

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

-(void) updateconstraints {    [Self.growingbutton mas_updateconstraints:^ (Masconstraintmaker *make) {        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);    }];        Call the parent updateconstraints    [Super updateconstraints];}

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.

-(void) changebuttonposition {    [Self.button mas_remakeconstraints:^ (Masconstraintmaker *make) {        Make.size.equalTo (self.buttonsize);                if (topleft) {       make.top.and.left.offset);        } else {       make.bottom.and.right.offset ( -10);}    }];}

iOS Development Basics-Fragmentation 24

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.