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!微笑

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值