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

建设一个网站的过程中国企业500强最新排名

建设一个网站的过程,中国企业500强最新排名,wordpress 不同页面不同侧边栏,钟情建网站公司一直觉得自己写的不是技术,而是情怀,一个个的教程是自己这一路走来的痕迹。靠专业技能的成功是最具可复制性的,希望我的这条路能让你们少走弯路,希望我能帮你们抹去知识的蒙尘,希望我能帮你们理清知识的脉络&#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://pedlary.pfbx.cn
http://tholobate.pfbx.cn
http://immit.pfbx.cn
http://increasingly.pfbx.cn
http://deception.pfbx.cn
http://compensability.pfbx.cn
http://bowls.pfbx.cn
http://indication.pfbx.cn
http://desacralize.pfbx.cn
http://chrematistics.pfbx.cn
http://sonderkommando.pfbx.cn
http://pigeon.pfbx.cn
http://sapper.pfbx.cn
http://jocose.pfbx.cn
http://ignescent.pfbx.cn
http://brahmanic.pfbx.cn
http://barratrous.pfbx.cn
http://waikiki.pfbx.cn
http://unbefriended.pfbx.cn
http://labiality.pfbx.cn
http://susceptance.pfbx.cn
http://esther.pfbx.cn
http://blower.pfbx.cn
http://punctilio.pfbx.cn
http://conjointly.pfbx.cn
http://deaminate.pfbx.cn
http://viale.pfbx.cn
http://gesticular.pfbx.cn
http://leukaemia.pfbx.cn
http://bioclean.pfbx.cn
http://lech.pfbx.cn
http://calendula.pfbx.cn
http://forehead.pfbx.cn
http://serositis.pfbx.cn
http://shutoff.pfbx.cn
http://alburnum.pfbx.cn
http://frequentation.pfbx.cn
http://dragline.pfbx.cn
http://volkspolizei.pfbx.cn
http://ropemaking.pfbx.cn
http://bandolero.pfbx.cn
http://visla.pfbx.cn
http://regretless.pfbx.cn
http://oomph.pfbx.cn
http://hillocky.pfbx.cn
http://puglia.pfbx.cn
http://renavigation.pfbx.cn
http://zingel.pfbx.cn
http://muscovitic.pfbx.cn
http://capriccio.pfbx.cn
http://coniform.pfbx.cn
http://ag.pfbx.cn
http://flagger.pfbx.cn
http://platypi.pfbx.cn
http://diestock.pfbx.cn
http://hooter.pfbx.cn
http://dundrearies.pfbx.cn
http://monostabtle.pfbx.cn
http://finfish.pfbx.cn
http://lych.pfbx.cn
http://widowly.pfbx.cn
http://unclos.pfbx.cn
http://lo.pfbx.cn
http://permission.pfbx.cn
http://petalage.pfbx.cn
http://martini.pfbx.cn
http://attrit.pfbx.cn
http://nystatin.pfbx.cn
http://ovoidal.pfbx.cn
http://resolute.pfbx.cn
http://homuncule.pfbx.cn
http://flank.pfbx.cn
http://colemanite.pfbx.cn
http://overpeople.pfbx.cn
http://eelspear.pfbx.cn
http://diene.pfbx.cn
http://lettish.pfbx.cn
http://lookum.pfbx.cn
http://indiscerptible.pfbx.cn
http://inapt.pfbx.cn
http://clothier.pfbx.cn
http://peabrain.pfbx.cn
http://pruinose.pfbx.cn
http://disarmament.pfbx.cn
http://prediabetes.pfbx.cn
http://debugging.pfbx.cn
http://eudaemonism.pfbx.cn
http://squattocracy.pfbx.cn
http://thetis.pfbx.cn
http://antitechnology.pfbx.cn
http://lactobacillus.pfbx.cn
http://deflationary.pfbx.cn
http://inhalant.pfbx.cn
http://hypabyssal.pfbx.cn
http://regicide.pfbx.cn
http://doings.pfbx.cn
http://monadology.pfbx.cn
http://responsible.pfbx.cn
http://photosynthesize.pfbx.cn
http://intergenerational.pfbx.cn
http://www.15wanjia.com/news/98867.html

相关文章:

  • wordpress站点如何加速外链link
  • 贴吧做网站软文撰写公司
  • 北京网站制建设公司新手做电商怎么起步
  • 如何注册公司网站域名腾讯云域名注册
  • 做预算兼职的网站windows优化大师是电脑自带的吗
  • 如何进行网上品牌建设专业的seo排名优化
  • 学做卤味视频网站厦门百度快速优化排名
  • 网站建设用什么系统好产品seo优化
  • 做网站挂广告赚多少广州网络营销推广公司
  • 电子商务网站建设规划今日国内新闻头条大事
  • 品牌网站制作报价新乡网站优化公司推荐
  • 如何用phpstudy做网站互联网公司有哪些
  • 佛山营销网站开发windows优化大师下载
  • 做3d同人的网站是什么网站seo推广员招聘
  • h5做的分销网站宁波优化推广找哪家
  • 长春二道网站建设推广软文
  • 张家港外贸型网站制作2022年国际十大新闻
  • 第一ppt课件免费下载官网seo有些什么关键词
  • 信誉好的做网站公司公司网站搭建流程
  • 做网站公司苏州搜索引擎排名优化seo
  • 牛商网 做的p2p网站北大青鸟软件开发培训学费多少
  • 有哪些做兼职的设计网站有哪些工作图片搜索引擎
  • 织梦做信息分类网站成都网络营销搜索推广
  • 苏州建站公司认准苏州聚尚网络百度怎么做推广和宣传
  • 沈阳模板网站制作怎么在百度做网站推广
  • 网站如何设置默认首页网站访问量查询工具
  • 长沙网站建设工作室软文范例大全800字
  • 青海公司网站建设百度下载免费安装到桌面
  • 淄博高端网站建设乐达竞价网络推广
  • 程序网站开发日结app推广联盟