zoukankan      html  css  js  c++  java
  • swift之Mac中NSStepper

    //步进器

        fileprivate let stepper : NSStepper = {

            let stepper = NSStepper(frame: NSMakeRect(0, 0, 100, 40))

            stepper.wantsLayer = true

            //设置背景色

            stepper.layer?.backgroundColor = NSColor.cyan.cgColor

            //最小值

            stepper.minValue = 5

            //最大值

            stepper.maxValue = 10

            //步长

            stepper.increment = 0.2

            //循环,YES - 超过最小值,回到最大值;超过最大值,来到最小值。

            stepper.valueWraps = false

            //默认为YES-用户交互时会立即放松ValueChanged事件,NO 则表示只有等用户交互结束时才放松ValueChanged事件

            stepper.isContinuous = false

            ///默认为 YES-按住加号或减号不松手,数字会持续变化.continuous = NO 时才有意义。

            stepper.autorepeat = true

            stepper.action = #selector(stepperAction(sender:))

            return stepper

        }()

        

        @objc func stepperAction(sender: NSStepper) {

            let theValue = sender.intValue

            let theFloatValue = sender.floatValue

            

        }

  • 相关阅读:
    [Tool]使用ConfuserEx混淆代码
    Python_安装官方whl包和tar.gz包
    0017_集合的补充
    0016_练习题d2
    0015_各数据类型方法代码实现
    0014_基本数据类型及常用方法剖析
    0013_运算符
    0012_编码转换
    0011_练习题d1
    0010_while循环
  • 原文地址:https://www.cnblogs.com/sundaymac/p/10338587.html
Copyright © 2011-2022 走看看