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

            

        }

  • 相关阅读:
    mybatis中#{}和${}的区别 (二)
    JAVA分布式架构的演变及解决方案
    mybatis中的#和$的区别
    https
    vue3的组件v-model初探1
    前端性能优化
    HTTP请求的完全过程
    http缓存详解,http缓存推荐方案
    vscode-setting备份
    Mac电脑在finder中添加- 右键打开vscode
  • 原文地址:https://www.cnblogs.com/sundaymac/p/10338587.html
Copyright © 2011-2022 走看看