在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):twho/material-design-widgets-lite-ios开源软件地址(OpenSource Url):https://github.com/twho/material-design-widgets-lite-ios开源编程语言(OpenSource Language):Swift 93.1%开源软件介绍(OpenSource Introduction):Material Design Widgets - LightweightThis framework give you full flexibility to apply any material design widget you would like to use in your app! Please see below steps if you only need to use one or two of the entire package widgets.
You may download MaterialDesignWidgetsDemo to see how its used in your app. Key Features
Requirements
InstallationMaterialDesignWidgets is available through CocoaPods. To install it, simply add the following line to your Podfile:
If you don't use CocoaPods, you can download the entire project then drag and drop all the classes and use them in your project. UsageButtons
Normal Buttonlet btnSample1 = MaterialButton(text: "Sample1", cornerRadius: 15.0)
let btnSample2 = MaterialButton(text: "Sample2", textColor: .black, bgColor: .white)
Loading Buttonlet btnLoading = MaterialButton(text: "Loading Button", cornerRadius: 15.0)
loadingBtn.addTarget(self, action: #selector(tapLoadingButton(sender:)), for: .touchUpInside)
@objc func tapLoadingButton(sender: MaterialButton) {
sender.isLoading = !sender.isLoading
sender.isLoading ? sender.showLoader(userInteraction: true) : sender.hideLoader()
}
Shadow Buttonlet btnShadow = MaterialButton(text: "Shadow Button", cornerRadius: 15.0, withShadow: true)
Vertical Aligned Buttonlet img = UIImage(named: "Your image name")
let btnV = MaterialVerticalButton(icon: img, title: "Fill", foregroundColor: .black, bgColor: .white)
Segmented Control
Filledlet sgFilled = MaterialSegmentedControl(selectorStyle: .fill, fgColor: .black, selectedFgColor: .white, selectorColor: .black, bgColor: .lightGray)
// Below is styling, you can write your own.
sgFilled.backgroundColor = .lightGray
sgFilled.setCornerBorder(cornerRadius: 18.0)
Outlinelet sgOutline = MaterialSegmentedControl(selectorStyle: .outline, fgColor: .black, selectedFgColor: .black, selectorColor: .black, bgColor: .white)
Line Textlet sgLine = MaterialSegmentedControl(selectorStyle: .line, fgColor: .black, selectedFgColor: .black, selectorColor: .black, bgColor: .white)
Line Iconlet sgLineIcon = MaterialSegmentedControl(selectorStyle: .line, fgColor: .black, selectedFgColor: .black, selectorColor: .gray, bgColor: .white)
Append Normal Segmentfor i in 0..<3 {
segCtrl.appendSegment(text: "Segment \(i)", textColor: .gray, bgColor: .clear, cornerRadius: radius)
} Append Icon Segmentlet icons = [yourImage1, yourImage2, yourImage3]
for i in 0..<3 {
sgLineIcon.appendIconSegment(icon: icons[i], preserveIconColor: true, rippleColor: .clear, cornerRadius: 0.0)
} Add Value Change ListenersegCtrl.addTarget(self, action: #selector(yourSegmentedControlValueChangeMethod), for: .valueChanged) TextField
let textField = MaterialTextField(hint: "TextField", textColor: .black, bgColor: .white)
Loading Indicator
let indicatorBlack = MaterialLoadingIndicator(radius: 15.0, color: .black)
indicatorBlack.startAnimating()
let indicatorGray = MaterialLoadingIndicator(radius: 15.0, color: .gray)
indicatorGray.startAnimating()
Storyboard UsageUse Material Button as an exampleSteps
Credits |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论