WKWebView dynamic height calculation based on font size - ios

I'm trying to calculate WKWebView content height according to font size. There is a lot of topic about it but none of it worked for me. I created demo app for test. In my test app I'm changing size of font via slider and I tried to calculate size of cell but I didn't get correct content size of webView.
Simply app work like that
Text downloaded from web.
Splitted to html array for add a different cell between webviews
cell.
When split html I add some tag for javascript injection(like
font size and font color)
Slider inject new font size to webviews and after that calculate
webView height again.
https://github.com/gelasdev/gelasdev-wkWebviewResize

Related

Label not displaying properly

I am beginner in iOS app development, I am working on a project that was done by someone else. So my problem is the label is not fully showing its contents:
check the second column under 'customer name'.
I did some basic alterations to the label but it makes no change at all. This is a collection view, there is another view inside the collection view cell which holds the title label and description label.
I searched everywhere but didn't get any proper answer please help.
Label in iOS does not change its size to suit the contents, you need to adjust it in your code. Your options are either decrease the font size to suit the description label size, or adjust the description label's height/width to make room for current content. I'd do a combination of both (slightly reducing the font size of the label's text, and at the same time making all the cells a bit wider and taller).
Oh, there is also a way to automatically shrink the font size if the contents doesn't fit the space. So, you'd need to check the option for your description label. Here's how you might do it: how to make UILabel autosize text in storyboard (or interface builder), NOT programmatically

Increase font size of launch screen label according to diffrent devices?

I have created a Launch screen.I have added one image & label on it.Now for diffrent screen size devices i am able to increase the size of image with autolayout.But i am not able to increase the font size of label.I can't use custom class of label for storyboard.So is there any way with i am able to increase font size for multiple devices on launch screen.
Option for different font size for different size class is available in storyboard.
NO. It is not possible to implement custom font for LaunchScreen, since LaunchScreen will be loaded before your custom fonts load. Better create different images with the text you want to display.
Well it is not possible you can write code for a launchScreen and handle some logic as for a conventional ViewController. Also you cannot use a custom class of label or extension. You can use only Auto-Layout and size classes. The detailed explanation is in the link

How to set different font size for UILabel for different iPhones in storyboard

I've been trying to set different font sizes for different iPhone sizes. I researched a lot about this but couldn't find the proper way of doing it. All I found is how to change uilabel text size in different iPhones which shows how to change the font size based on hard coded values that too programmatically. I'm looking for changing the font size using storyboard i.e adaptive layout. Another popular answer I found was to add wC hAny in storyboard. But, this can only be used to set the different font size for an iPad and iPhone(not for different iPhone sizes). Any help would be appreciated.
One way to do this is to set the minimum font size for the label. Then set your constraints so when the labels get squished in a tighter area the font will shrink to fit on the screen.

determining height to be set based on font size in iOS

In IOS, we have height and font size for UI label.
When I add a uilabel to the screen, I see a default height and font for it and height is always bit more than the font size to take care of ascenders and descenders. But when I increase the font size in design time, the height still remains at where it was when it was added to the screen. So, how to I decide during design time what is the appropriate height to be set if I change the font size to what I want.
Edit the text of the label and press enter, it will take it's size
Click your label in the canvas so that you get its resize handles. Then, from the menu bar, choose Editor > Size to Fit Content. The default shortcut is ⌘=.

Minimum placeholder Font size for iPad app

I am making an iPad app and there are textfields with placeholders in it.
There are many textfields, so I don't know if the user will be able to see the placeholders.
Does anyone know what is the minimum font size advisable for a placeholder? I don't want the user to keep zooming to see what the placeholder says.
The placeholder's default size itself should be fine. As of modifying the size - it is a string and hence you can't modify the textsize attributes.

Resources