美文网首页
iOS UITextField 内边距

iOS UITextField 内边距

作者: 我会回来的 | 来源:发表于2022-11-11 16:37 被阅读0次

    override func textRect(forBounds bounds: CGRect) -> CGRect {

            // top left

            CGRect(x: bounds.minX, y: bounds.minY, width: bounds.width / 2, height: bounds.height / 2)

        }

        override func placeholderRect(forBounds bounds: CGRect) -> CGRect {

            // top right

            CGRect(x: bounds.midX, y: bounds.minY, width: bounds.width / 2, height: bounds.height / 2)

        }

        override func borderRect(forBounds bounds: CGRect) -> CGRect {

            // bottom left

            CGRect(x: bounds.minX, y: bounds.midY, width: bounds.width / 2, height: bounds.height / 2)

        }

        override func editingRect(forBounds bounds: CGRect) -> CGRect {

            // bottom right

            CGRect(x: bounds.midX, y: bounds.midY, width: bounds.width / 2, height: bounds.height / 2)

        }

    相关文章

      网友评论

          本文标题:iOS UITextField 内边距

          本文链接:https://www.haomeiwen.com/subject/itsztdtx.html