Question

I'm developing a native iOS app and mostly use Cocoa touch UI elements. But for one particular screen I found it is very difficult and time consuming to use native cocoa elements to get responsive layout: enter image description here

The problem is that I would need to setup a lot of constraints, introduce container views etc. I would need to programmatically calculate the labels size and resize if it takes more then 1 line etc...

It seems building this with HTML would be much easier, reliable and easier to modify in future. Is that a good practice to use UIWebView instead of native UI elements to show such layouts? What problems can I have with that?

Was it helpful?

Solution

If all content on your screen is non-interactive text then it's really easier to use UIWebView instead of using a lot of native ui controls and relations between them.
But in general there are few disadvantages of using UIWebView instead of native controls:

  1. Implementing interactive controls by web view is not easy task (If it's possible that in the future your labels will become clickable and interactive then it's better use UICollectionView + UILabels toolset).
  2. Compiler analyser can't check content of web view because usually NSString is used for storing content. So it's difficult to debug those part of logic that implemented by web view.
  3. In general web view object needs more memory allocation then other native touch controls. But I am not sure that it so in your case (where need use a lot of UILabel objects).

OTHER TIPS

NO, It's not good practice with native-app. You need to decide which way is easier to implement and modify in future. Ex. You can create Table view with custom cell for above design.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top