alexmx / amxfontautoscale Goto Github PK
View Code? Open in Web Editor NEW⚠️ Experimental automatic cross-device font scaling for UILabel and UITextView.
License: MIT License
⚠️ Experimental automatic cross-device font scaling for UILabel and UITextView.
License: MIT License
Hi ,Thank you for this helpful library. I have a problem updating my label which added to my ViewController using xib.
override func viewDidAppear() {
super.viewDidAppear()
myLabel.amx_autoScaleFont(forReferenceScreenSize: .size4Inch)
}
override func viewDidLayoutSubviews() {
// Here i add my View which includes myLabel using xib
let startView = UINib(nibName: "StartView", bundle: .main).instantiate(withOwner: self, options: nil).first as! UIView
}
When upgrading to Swift 4, I see the following errors:
Instance member 'amx_autoScaleFont' cannot be used on type 'UILabel'; did you mean to use a value of this type instead?
Instance member 'amx_autoScaleFont' cannot be used on type 'UITextView'; did you mean to use a value of this type instead?
My only AMX code is in my didFinishLaunchingWithOptions:
UILabel.amx_autoScaleFont(forReferenceScreenSize: .size5p5Inch)
UITextView.amx_autoScaleFont(forReferenceScreenSize: .size5p5Inch)
After pod installing, application not starting
dyld: Library not loaded: @rpath/AMXFontAutoScale.framework/AMXFontAutoScale
Referenced from: /Users//Library/Developer/CoreSimulator/Devices/85D96D3A-239A-4DE6-AA72-1B53E360D852/data/Containers/Bundle/Application/AA7EC658-AFD4-4FD1-BE18-30F5A23CDE22//*
Reason: image not found
I m unable to perform instance scaling, Is there any workaround other then your provided code snippet. While global scaling is doing great
I have applied instance auto scaling on textView in viewDidLoad, when pop back to this screen after some navigation font gets increased, applying same steps result in further increment. I ve tried with UILabel, its also resulting same issue. Can you pls see into this?
I am getting issue in Landscape mode.
Font Size increase too much.
When I use your library, if I have more than one font in my attribute text, only the first font was loaded.
exemple of code, in this case, my text was only with font HoeflerTitling-Light.
`
let lb = UILabel(frame: CGRect(x: 0, y: 0, width: 160, height: 44)) lb.amx_autoScaleFont(forReferenceScreenSize: .size4Inch)
lb.amx_autoScaleEnabled = true
let alight = UIFont(name: "HoeflerTitling-Light", size: 22)!
let alightItalic = UIFont(name: "HoeflerTitling-LightItalic", size: 22)!
let myAttributeLight = [NSFontAttributeName: alight, NSForegroundColorAttributeName: UIColor(rgba: "#ed403d"), NSParagraphStyleAttributeName: paragraph]
let attrString = NSAttributedString(string: "La Guía".localized(), attributes: myAttributeLight)
myString.append(attrString)
let myAttributeLightItalic = [NSFontAttributeName: alightItalic, NSForegroundColorAttributeName: UIColor(rgba: "#ed403d"), NSParagraphStyleAttributeName: paragraph]
let attrStringItalic = NSAttributedString(string: "del Prado".localized(), attributes: myAttributeLightItalic)
myString.append(attrStringItalic)
lb.attributedText = myString
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.