gpt4 book ai didi

iphone - IOS中UI实现查询

转载 作者:行者123 更新时间:2023-11-29 04:06:42 25 4
gpt4 key购买 nike

我正在开发一个需要录制和播放音频文件的应用程序。我已经完成了与录音和播放相关的所有事情。这次我对 UI 相关的事情有点困惑,可能是第一次遇到这种困惑。 Play back .

根据上图,我需要显示播放轨迹,到目前为止,我已经用进度条和 slider 做了很多工作来显示播放秒数或服务器响应。我正在检查自己是否执行此操作,但我没有得到任何确切的想法。有人可以建议我任何实现同样的想法吗?您的建议对我的工作更有用。提前致谢。

最佳答案

您可以使用我在下面发布的类,并在背景图像之间使用它,并在其顶部添加暂停/播放按钮。对于当前位置的资源(小环),您可能需要使用基本三角学。

一个简单的 UIView 子类,根据进度绘制一个环。它可能需要通过配置圆半径等方式进行一些爱:

CircleProgressView.h

@interface CircleProgressView : UIView
{
double progress_;
UIColor *color_;
}

- (void)setProgress:(float)progress;
- (void)setColor:(UIColor *)color;


@end

CircleProgressView.m

@implementation CircleProgressView

- (void)setProgress:(float)progress
{
_progress_ = progress;
[self setNeedsDisplay];
}

- (void)setColor:(UIColor *)color
{
color_ = color;
}

- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 6);
CGContextSetStrokeColorWithColor(context, color_.CGColor);
CGContextAddArc(context,
self.frame.size.width / 2.0,
self.frame.size.height / 2.0,
self.frame.size.width / 2 - 4.5, 0.0, M_PI * progress_ * 2.0, NO);

CGContextStrokePath(context);
}

关于iphone - IOS中UI实现查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15082237/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com