Post

Replies

Boosts

Views

Activity

physical keyboard handling in iOS
hello, what is the best way to handle this request:when user presses return/enter on a physical keyboard connected to iOS device the app shall do one thing (take the contents of UITextView and proceed with it), and when the user presses alt+return/enter on a physical keyboard the app shall do another thing (treat it as a usual text input and change UITextView contents accordingly). ideally when user pastes the "\n" symbol via copy / paste the app shall treat it as a normal text input following the second path, but that requirement can be sacrificed.i tried overriding pressesBegan in a UITextView subclass but don't see it being called.is there a way to take the current keyboard modifiers on iOS? (similar to the ancient GetKeys on mac for those who remember)
0
0
392
May ’20
vector image instantiation (PDF)
Xcode supported inclusion of PDF files for quite a while now. first it was done by converting them into png images at build time, lately you would be able setting "Preserve Vector Data" in the asset catalogue's image so that would keep vector images "vector" all until rendering. but how that's actually done internally? i don't seem able to use UIImage(data: pdfFileData) to build images from pdfs. i can use UIGraphicsImageRenderer based code or another code that creates CGContext of a needed size and draws PDF into it, but i wonder how system does this? any code that i can think of requires creating bitmap context of a particular size (in pixels) and rendering into it, which loses the "vectorness" of the image (ability to scale nicely). so the question is, if my image assets are not available at build time (and i am not able including them into an asset catalogue, but have them as a Data instances at runtime) what is the way to mimic the system behaviour of creating vector-preserved UIImage's out of pdfs?
0
1
718
Nov ’20