当前位置:编程学习 > wap >>

iphone/ipad实现自定义的开关UISwitch(continuous,clipsToBounds,userInteractionEnabled属性)

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

@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。

 


 

补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,