zoukankan      html  css  js  c++  java
  • 根据图片大小,自动设置按钮大小

    根据图片大小,自动设置按钮大小。用(CGREC){CGPointZero,leftImage.size}强转

    不要直接拿按钮文字,拿出来的是空的。因为按钮文字是分状态的。要用NSString *btnTitle = [btn titleForState:UIControlStateNormal

    锚点anchorPoint和position。btn.layer.anchorPoint;btn.layer.position

    //点击触发方法,pointInside和hitTest

     通过position定义可以知道position是layer中的anchorPoint点在superLayer中的位置坐标.position点是相对superLayer的.

    anchorPoint是相对于自身layer,anchorPoint点(锚点)的值是用相对bounds的比例值来确定的

     

       /* Defines the anchor point of the layer's bounds rect, as a point in

         * normalized layer coordinates - '(0, 0)' is the bottom left corner of

         * the bounds rect, '(1, 1)' is the top right corner. Defaults to

         * '(0.5, 0.5)', i.e. the center of the bounds rect. Animatable. */

    open var anchorPoint: CGPoint

     

     

    https://www.jianshu.com/p/f9a83a72e274

    图片拉伸

    [image resizableImageWithCapInsets:UIEdgeInsetsMake(5555resizingMode:UIImageResizingModeStretch]; 

    // 代表按钮变为UIControlStateDisabled状态

                share.enabled = NO;

    // 设置分享按钮的选中状态是真

                share.selected = YES;            

    // 按钮在高亮的时候不需要变灰色

                share.adjustsImageWhenHighlighted = NO;

                

  • 相关阅读:
    如何处理请求返回的二进制数据流转化成xlsx文件?
    iview 表单验证不通过问题?
    如何发布一个npm包?
    async 与 await
    数据库事务的四个基本特征以及事务的隔离级别
    遍历Map的四种方式
    HashMap详解
    HashMap和Hashtable的区别
    java中的堆、栈和常量池简介
    Spring IOC(转载)
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/4743352.html
Copyright © 2011-2022 走看看