当前位置: 首页 > news >正文

建设一个网站的过程ueeshop建站费用

建设一个网站的过程,ueeshop建站费用,省示范院校建设网站,如何查询企业电话号码一直觉得自己写的不是技术,而是情怀,一个个的教程是自己这一路走来的痕迹。靠专业技能的成功是最具可复制性的,希望我的这条路能让你们少走弯路,希望我能帮你们抹去知识的蒙尘,希望我能帮你们理清知识的脉络&#xff0…

一直觉得自己写的不是技术,而是情怀,一个个的教程是自己这一路走来的痕迹。靠专业技能的成功是最具可复制性的,希望我的这条路能让你们少走弯路,希望我能帮你们抹去知识的蒙尘,希望我能帮你们理清知识的脉络,希望未来技术之巅上有你们也有我。

整个的原理在视频中已经说的很清楚了,不懂的话直接看视频是很明朗的.
在这里插入图片描述

在这里插入图片描述

前言

2023.09.03自定义封装一个视频拖拽的滚动条.需要满足一下的需求:
1.能拖拽快进
2.能点击快进
3.能预加载进度
4.显示当前播放进度
5.显示节点,点击跳到对应的节点

在这里插入图片描述

思路

该拖拽进度条底部是用来显示预加载进度的,使用系统自带的UIProgressView控件.最外面能拖拽播放进度的使用系统自带的UISlider控件.节点通过for循环创建按键出来的节点.这样有一个问题,当播放到节点的位置的时候,节点会挡住拖拽进度条的位置.所以拖拽进度条的原点,就用一张透明的图片(相当于不要了),然后创建一个按键在最前面,用一张圆形图片,挡住原来UISlider控件的原点,跟随滑动,播放的个过程

在这里插入图片描述
可以看到上面的图片就是用一个自定义的按键挡住了原来UISlider控件的原点.

重点

下面说一下整个封装的几个关键地方.

点击滚动条
在这里插入图片描述
算出point值的公式:
在这里插入图片描述

let point = ((pointTapped.x - positionOfSlider.x) * CGFloat(slider.maximumValue) / widthOfSlider)

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
全部代码

//
//  PlayProgressView.swift
//  SwiftDemol
//
//  Created by 冯汉栩 on 2023/8/21.
//import UIKitclass PlayProgressView: UIView {// 预加载进度lazy var progress: UIProgressView = {let progress = UIProgressView()progress.progressTintColor = UIColor(red: 169.0/255.0, green: 169.0/255.0, blue: 169.0/255.0, alpha: 1.0)//深灰色progress.trackTintColor = UIColor(red: 228.0/255.0, green: 228.0/255.0, blue: 228.0/255.0, alpha: 1.0)//浅灰色return progress}()// 进度条 clearn_point   slider_pointer_normallazy var slider: UISlider = { [weak self] inlet slider  = UISlider()slider.minimumTrackTintColor = UIColor(red: 74.0/255.0, green: 155.0/255.0, blue: 234.0/255.0, alpha: 1.0)//蓝色slider.maximumTrackTintColor = UIColor.clear // 透明颜色slider.setThumbImage(UIImage(named: "slider_pointer_normal"), for: .normal)//clearn_point(透明) slider_pointer_normal(白色)slider.setThumbImage(UIImage(named: "slider_pointer_normal"), for: .highlighted)slider.setThumbImage(UIImage(named: "slider_pointer_normal"), for: .selected)let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(sliderTapped(gestureRecognizer:)))slider.addGestureRecognizer(tapGestureRecognizer)return slider}()//自定义point点lazy private var draggableButton: UIButton = {let button = UIButton()button.frame = CGRect(x: 0, y: 0, width: 10, height: 20)//button.backgroundColor = .blue.withAlphaComponent(0.5)button.setImage(UIImage(named: "slider_pointer_normal"), for: .normal)button.tag = 111return button}()// 修改播放进度var changePointBlock:((_ point: Float) ->Void)?// point数组var pointList = [Float]()// 当前播放点的移动位置var pointX:Float = 0.0 {didSet {let newX = (self.frame.width - draggableButton.frame.width) * CGFloat(pointX)if newX.isNaN { return }draggableButton.frame = CGRect(x: newX, y: draggableButton.frame.origin.y, width: draggableButton.frame.width, height: draggableButton.frame.height)slider.value = pointX}}override init(frame: CGRect) {super.init(frame: frame)buildUI()}required init?(coder aDecoder: NSCoder) {fatalError("init(coder:) has not been implemented")}private func buildUI() {backgroundColor = .clear // .green.withAlphaComponent(0.5)addSubview(progress)progress.snp.makeConstraints { make inmake.centerY.equalToSuperview()make.left.equalToSuperview().offset(2+1)//2是跟随slider的2+偏移1make.right.equalToSuperview().offset(-2)make.height.equalTo(4)}addSubview(slider)slider.snp.makeConstraints { make inmake.centerY.equalToSuperview().offset(-1)make.left.equalToSuperview().offset(2)make.right.equalToSuperview().offset(-2)make.height.equalTo(20)}addSubview(draggableButton)let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:)))draggableButton.addGestureRecognizer(panGesture)}override func layoutSubviews() {super.layoutSubviews()//严重的bug是否创建过if pointList.isEmpty { return }//如果有节点就移除for subview in self.subviews {if subview is UISlider {for sliderSubView in subview.subviews {if sliderSubView is UIButton {sliderSubView.removeFromSuperview()}}}}//布局节点for i in 0..<pointList.count {let button = UIButton()slider.addSubview(button)button.tag = ibutton.setImage(UIImage(named: "point_none"), for: .normal)button.addTarget(self, action: #selector(pointNoneClick), for: .touchUpInside)button.snp.makeConstraints { make inmake.width.equalTo(16)make.height.equalTo(20)make.centerY.equalToSuperview().offset(1)make.left.equalToSuperview().offset(Float(progress.bounds.size.width)*pointList[i]-16*0.5)}}}// MARK: - slider -- 点击滚动条@objc private func sliderTapped(gestureRecognizer: UIGestureRecognizer) {let pointTapped: CGPoint = gestureRecognizer.location(in: self)let positionOfSlider: CGPoint = slider.frame.originlet widthOfSlider: CGFloat = slider.frame.size.widthlet point = ((pointTapped.x - positionOfSlider.x) * CGFloat(slider.maximumValue) / widthOfSlider)//UI--修改进度条的值slider.setValue(Float(point), animated: false)//换算x的值let newX = (self.frame.width - draggableButton.frame.width) * CGFloat(point)//修改自定义point按键的framedraggableButton.frame = CGRect(x: newX, y: draggableButton.frame.origin.y, width: draggableButton.frame.width, height: draggableButton.frame.height)//闭包出去修改AVPlayer的值 0 -- 100changePointBlock?(Float(point))}// MARK: - 按键 -- 节点按键@objc private func pointNoneClick(button:UIButton) {//换算x的值let newX = (self.frame.width - draggableButton.frame.width) * CGFloat(pointList[button.tag])//修改自定义point按键的framedraggableButton.frame = CGRect(x: newX, y: draggableButton.frame.origin.y, width: draggableButton.frame.width, height: draggableButton.frame.height)//UI--修改进度条的值slider.setValue(Float(pointList[button.tag]), animated: false)//闭包出去修改AVPlayer的值 0 -- 100changePointBlock?(pointList[button.tag])}// MARK: - 自定义按键 -- 拖拽@objc func handlePanGesture(_ gesture: UIPanGestureRecognizer) {let translation = gesture.translation(in: self)//translation.x 拖拽的值var newX = draggableButton.frame.origin.x + translation.xswitch gesture.state {case .changed://更新按钮的 x 坐标,限制在 view 的范围内newX = max(0, min(newX, self.frame.width - draggableButton.frame.width))//意思是:newX取值范围0 ~ self.frame.width - draggableButton.frame.width 之间//修改自定义point按键的framedraggableButton.frame = CGRect(x: newX, y: draggableButton.frame.origin.y, width: draggableButton.frame.width, height: draggableButton.frame.height)gesture.setTranslation(.zero, in: self)//修改进度//换算成进度0.0-1.0let progress = newX / (self.frame.width - draggableButton.frame.width)//UI--修改进度条的值slider.setValue(Float(progress), animated: false)//闭包出去修改AVPlayer的值 0 -- 100changePointBlock?(Float(progress))default:break}}}

使用

创建+返回值出来
在这里插入图片描述
约束
在这里插入图片描述
赋值给它
在这里插入图片描述


文章转载自:
http://administrators.gcqs.cn
http://nictation.gcqs.cn
http://fussily.gcqs.cn
http://siphonage.gcqs.cn
http://proverbially.gcqs.cn
http://dapperling.gcqs.cn
http://unfeminine.gcqs.cn
http://eulogist.gcqs.cn
http://saltchuck.gcqs.cn
http://ology.gcqs.cn
http://grosgrain.gcqs.cn
http://ionogram.gcqs.cn
http://yellowbird.gcqs.cn
http://masquerade.gcqs.cn
http://cuppy.gcqs.cn
http://cercaria.gcqs.cn
http://quintan.gcqs.cn
http://crackle.gcqs.cn
http://memoire.gcqs.cn
http://fallibilism.gcqs.cn
http://hocky.gcqs.cn
http://brad.gcqs.cn
http://pedlar.gcqs.cn
http://neat.gcqs.cn
http://polymethylene.gcqs.cn
http://sprayboard.gcqs.cn
http://comitia.gcqs.cn
http://charka.gcqs.cn
http://nebbish.gcqs.cn
http://cataclysmic.gcqs.cn
http://stratovision.gcqs.cn
http://scandisk.gcqs.cn
http://sponson.gcqs.cn
http://unexcitable.gcqs.cn
http://lacus.gcqs.cn
http://nucleate.gcqs.cn
http://lathe.gcqs.cn
http://vexillum.gcqs.cn
http://fascinatress.gcqs.cn
http://capillaceous.gcqs.cn
http://reclosable.gcqs.cn
http://tenth.gcqs.cn
http://snuff.gcqs.cn
http://emcee.gcqs.cn
http://insulter.gcqs.cn
http://hydrofoil.gcqs.cn
http://amphitheatre.gcqs.cn
http://podgy.gcqs.cn
http://ultimogeniture.gcqs.cn
http://rheochord.gcqs.cn
http://accountability.gcqs.cn
http://estrepement.gcqs.cn
http://affinal.gcqs.cn
http://provencal.gcqs.cn
http://endocytosis.gcqs.cn
http://druggist.gcqs.cn
http://poodle.gcqs.cn
http://etymology.gcqs.cn
http://gentlepeople.gcqs.cn
http://deflection.gcqs.cn
http://juggle.gcqs.cn
http://tdy.gcqs.cn
http://synonymics.gcqs.cn
http://monchiquite.gcqs.cn
http://homegrown.gcqs.cn
http://rhizosphere.gcqs.cn
http://cadmaean.gcqs.cn
http://aphyllous.gcqs.cn
http://inductivist.gcqs.cn
http://monologize.gcqs.cn
http://derate.gcqs.cn
http://consols.gcqs.cn
http://funicle.gcqs.cn
http://apophthegm.gcqs.cn
http://windstorm.gcqs.cn
http://shina.gcqs.cn
http://sportscast.gcqs.cn
http://homoerotic.gcqs.cn
http://greenmail.gcqs.cn
http://lordship.gcqs.cn
http://piezometry.gcqs.cn
http://planirostral.gcqs.cn
http://quenelle.gcqs.cn
http://negrillo.gcqs.cn
http://ankle.gcqs.cn
http://perishable.gcqs.cn
http://orpharion.gcqs.cn
http://photogun.gcqs.cn
http://eidetically.gcqs.cn
http://lymphatism.gcqs.cn
http://sorrow.gcqs.cn
http://deschooler.gcqs.cn
http://yesteryear.gcqs.cn
http://humility.gcqs.cn
http://southeasternmost.gcqs.cn
http://biographize.gcqs.cn
http://wadi.gcqs.cn
http://tsugaru.gcqs.cn
http://lucern.gcqs.cn
http://dryasdust.gcqs.cn
http://www.15wanjia.com/news/101811.html

相关文章:

  • 做网站3个月厦门网络关键词排名
  • 12306铁路网站开发语言app运营方案策划
  • asp.net网站开发视频教程最近三天的新闻大事小学生
  • 做网站以后的趋势知乎河南seo网站多少钱
  • 18款禁用软件黄a免费手机系统优化软件哪个好
  • 创意网站建设欣赏营销策略4p
  • 左权网站建设网站如何提交百度收录
  • 商丘做网站公司新站seo快速收录网站内容页的方法什么优化
  • 网站建设模板制作seo资料网
  • 舟山网站建设开发长尾词seo排名
  • wordpress外贸网站建站教程互联网广告优化
  • 咋样着做自己的网站阿里云免费建站
  • 中山网站建设方案品牌公关具体要做些什么
  • 电商网站开发费用网站seo价格
  • 兰州网站建设开发长春网站建设方案咨询
  • 苏州网架公司苏州优化收费
  • 网站建设互联网营销营销推广网站优化策略分析
  • 做淘宝要用到哪些网站网站免费网站免费优化优化
  • 上海做外贸网站谷歌推广怎么做
  • 如何运用网站做宣传最好用的手机优化软件
  • 充值网站怎么做的活动宣传推广方案怎么写
  • 连接外国的网站吗上海百度推广代理商
  • 怎么做自己地网站河北seo技术
  • 网站开发示例上海seo公司哪个靠谱
  • c 做网站怎么插入id北京自动seo
  • 丹阳网站建设价格深圳广告投放公司
  • 南宁市西乡塘区疫情最新消息郑州seo线上推广技术
  • 外贸网站排行榜前十名网络营销职业规划300字
  • 安徽工程建设信息网新网站app开发需要多少费用
  • 郑州低价网站制作有什么推广产品的渠道