AutoLayout Uiimageview Change Position according to the width of the Uilabel

Source: Internet
Author: User

Only individual study notes, Daniel do not spray

Code notation using Masonry

1 //Nickname2     3_namelableview =[[UILabel alloc]init];4     5[_namelableview Settextcolor:rgb ( +,164,232)];6     7_namelableview.font=[uifont systemfontofsize: -];8     9     //_namelableview.backgroundcolor = [Uicolor graycolor];Ten      One[_namelableview SetText:@"Tom"]; A  - [_souceview Addsubview:_namelableview]; -      the     //Sex Icons -_seximageview =[[Uiimageview alloc]init]; -      -[_seximageview setimage:[uiimage imagenamed:@"Woman_icon"]]; +      - [_souceview Addsubview:_seximageview]; +      A[_namelableview mas_makeconstraints:^ (Masconstraintmaker *Make ) { atMake.top.equalTo (_namelableview.superview.mas_top). With.offset ( the); -Make.left.equalTo (_headbuttonview.mas_right). With.offset (Ten); -         //Make.right.equalTo (_seximageview.mas_left). With.offset (5); -          -         //Make.height.mas_equalTo (+); -Make.width.mas_lessThanOrEqualTo (screenwidth- -); in     }]; -      to[_seximageview mas_makeconstraints:^ (Masconstraintmaker *Make ) { +Make.top.equalTo (_seximageview.superview.mas_top). With.offset ( -); -Make.left.equalTo (_namelableview.mas_right). With.offset (5); the          *          $Make.width.mas_equalTo ( -);Panax NotoginsengMake.height.mas_equalTo ( -); -}];

Uistoryboard notation

Image source Cocoachina User:Kiushuo

AutoLayout Uiimageview Change Position according to the width of the Uilabel

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.