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

            

        }

  • 相关阅读:
    hdu 4638 Group 线段树
    hdu 4635 Strongly connected 强连通分量
    hdu 4604 Deque
    hdu 1000 A + B Problem
    数组相关
    文本文件相关
    硬件电路中VCC,VDD,VEE,VSS有什么区别
    VIPM链接LabVIEW问题
    Touch实现轻扫
    touchesMoved 实现拖拽
  • 原文地址:https://www.cnblogs.com/sundaymac/p/10338587.html
Copyright © 2011-2022 走看看