zoukankan      html  css  js  c++  java
  • iphone/ipad实现自定义的开关UISwitch(continuous,clipsToBounds,userInteractionEnabled属性)

    这里主要讲几个UIView的几个属性,具体大家可以下载代码看看,

    下载地址是:

    http://download.csdn.net/detail/rhljiayou/5960003

    实现效果是:

    代码中有设计到几个我不常用的属性:

    @property(nonatomic,getter=isContinuous) BOOL continuous;        // if set, value change events are generated any time the value changes due to dragging. default = YES

    这个是UISlider当中的一个属性,作用是,当你拖动轨迹按钮的时候,如果这个属性是yes,那么它就会处发sliderValueChanged方法,设为no就拖动的时候不会处发。

    如果想处发sliderValueChanged方法,那就用        [self sendActionsForControlEvents:UIControlEventValueChanged];

    @property(nonatomic)                 BOOL              clipsToBounds;              // When YES, content and subviews are clipped to the bounds of the view. Default is NO.

    这个是UIView当中的一个属性,作用是,view如果超出了父视图的界线,可以用这个来显示遮挡的部分,设为yes为遮挡住,默认为no不遮挡。

    @property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled;  // default is YES. if set to NO, user events (touch, keys) are ignored and removed from the event queue.

    这个是UIView当中的一个属性,比如窗口中有一个UIButton按钮,然后我在上面又添加了一个UIView盖在uibutton上面,那么这个UIButton按钮就得不到响应,为了使这个按钮得到响应,应该设置这个属性为no,默认的是yes。


    ok!微笑

  • 相关阅读:
    洛谷 P1313 计算系数
    洛谷 P1088 火星人
    洛谷 P1049 装箱问题
    P5016 龙虎斗
    洛谷P1208
    求lca
    没有上司的舞会
    最短路spfa
    懒羊羊找朋友
    简单的图论问题之单源最短路dijkstra算法
  • 原文地址:https://www.cnblogs.com/james1207/p/3262812.html
Copyright © 2011-2022 走看看