半圆形进度条,渐变快速

时间:2019-12-07 09:32:11

标签: ios swift progress-bar gradient swift4.2

我想在iOS中使用swift创建具有渐变颜色的 @Inject DashboardFragment dashboardFragment; @Inject public HomeViewPageAdapter(FragmentManager fragmentManager) { super(fragmentManager , BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT); MyApplication.component.inject(this); } 。进度条的最小值是300,进度条的最大值是900。进度条的当前值是动态的。我附上了ans css屏幕截图,以供参考。有人可以给我提供一个小型的工作演示吗?

Half Circular progress

下面是CSS-

        @Module
public class HomeActivityModule {

    @Provides
    HomeViewPageAdapter provideHomeViewPageAdapter(HomeActivity homeActivity) {
        return new HomeViewPageAdapter(homeActivity.getSupportFragmentManager());
    }
}

Properties

1 个答案:

答案 0 :(得分:1)

您可以使用称为的框架创建不相同但相似的进度条 MKMagneticProgress

示例代码:-

import MKMagneticProgress

@IBOutlet weak var magProgress:MKMagneticProgress!

override func viewDidLoad() {
    magProgress.setProgress(progress: 0.5, animated: true)
    magProgress.progressShapeColor = UIColor.blue
    magProgress.backgroundShapeColor = UIColor.yellow
    magProgress.titleColor = UIColor.red
    magProgress.percentColor = UIColor.black

    magProgress.lineWidth = 10
    magProgress.orientation = .top
    magProgress.lineCap = .round

    magProgress.title = "Title"
    magProgress.percentLabelFormat = "%.2f%%"

}

我希望它能起作用...:)