UICollectionView lags on scroll when im rendering Hindi font - ios

I'm using a Hindi font in collection view cell, there are almost 15 cells loaded into collection view
on scroll it lags, when I use the English language it scrolls smooth, But when I change the language to Hindi it starts to lag on scroll
Is there any way to solve this issue? any font caching option for font?
Is there any way to improve this using CoreText rendering?

I would recommend reading this article. It has a comprehensive set of scrolling optimisation practices for UITableViews and UICollectionViews
UPD
In your case I would look into TextKit documentation:
Text views, created from the UITextView class, are meant to display large amounts of text. Underlying UITextView is a powerful layout engine called Text Kit. If you need to customize the layout process or you need to intervene in that behavior, you can use Text Kit.
Hope this helps.

Finally, I found the issue causing scroll lag:
The lag came because UITextView's scroll was disabled and on each scroll it had to calculate the height with rendering font.
I tried with fixed height for UITextView and scroll was enabled for the same the lag disappeared

Related

iOS 13 Voice Control UIScrollView

The iOS13 Voice Control feature has a command 'Scroll Down'. This command works for UITableViews but does not seem to work for UIScrollViews with scrollable content.
Is this intended?
Intended or not, is there a way to enable this command to work on a UIScrollView?
Example: a UILabel with a lot of text inside a UIScrollView (constraints are correct - it scrolls and is acknowledged by Voice Over saying 'Page 1 of 3' when active)
This command works for UITableViews but does not seem to work for UIScrollViews with scrollable content.
... only if this content is a huge UILabel content that must be scrollable: add many other elements (sliders, buttons...) and you'll notice that scrolling is enabled.
About that, in the TextKit Best Practices (2018 WWDC video), it's highly recommended to use a UITextView for this purpose:
Is there a way to enable this command to work on a UIScrollView?
Switch the label and your scroll view for a text view instead to make the Voice Control feature work with your specific use case.
Otherwise, it works with many other elements different from UILabel: the scroll view knows its content size and when it has to scroll down/up but the Voice Control feature doesn't recognize the label content as an element to directly interact with inside a scroll view.
I tested with a button and a huge UILabel as you did:
Scroll down that worked to reach the end of my label.
Scroll up that never works.
The label seems to be a kind of empty box that Voice Control ignores in a scroll view: to enable this command in a scroll view, just replace your label by a text view.
Now, if your use case is a single UILabel in a UIScrollView, remove them to display a UITextView instead.
EDIT
Here's the Xcode screenshot to make the UITextView scrolling work with the VoiceControl feature:
... with the results hereunder:
As you can notice, this is just a blank project with a simple text view: iOS recognizes this single element and acts as desired when Scroll down and Scroll up are vocalized.

Text is not appearing when UITextView's content is more?

I don't need to scroll inside a UITextView so disabling a scrolling property of my UITextView.
It means UITextView's height is dynamic base on his content.
When I added more text in UITextView then text is not appearing.
It is working with less content.
As per my observation if height of UITextView exceeds 8100 then it stops rendering but not sure about it.
here is a structure of storyboard.
I understand your problem and please check below sample, i am modify your sample. This is working in my case.
Refer:- Updated Demo

Show large amount of attributed text efficiently using textkit without using paging

I have a large text file and I need to show it continuously, like one can do in textview. However, the rendering of the text takes a lot of time in UILable/UITextView. I have tried working with TextKit to only render the portion of the text visible on screen but was unsuccessful. TextContainer's height need to be set depending on the content height for it to work and that is no better than using UITextView or UILabel.
Is there a way to only render the portion of the text that is visible on screen without using paging. Please share your thoughts on if that is achievable with high performance.
thanks

RichText label or 'flow' layout for text in iOS (Xamarin/MonoTouch)

I am trying to repduce a similar sort of layout as in the screenshot below from the Digg app..
Notice that each list entry has a title in bold followed by the source, posted time and finally if there is enough space the start of the description line.
The question is what is the best way to achieve this in iOS? With some posts having longer titles than others I cannot simply say that the title label is 40px high and then place the Source label at 45 as the title will sometimes be longer and sometimes shorter.
Do I have to calculate the height of the label based on its contents before arranging the layout or is there some better way of doing this in iOS so that the views 'below' are automatically moved down?
Another alternative would be some sort of rich text label that I could add all the text to and have it automatically wrap round moving the later text down but I cannot find any sort of control in standard iOS / Xamarin (MonoTouch).
Any pointers would be greatly appreciated?
If you are using a storyboard the simplest way to achieve this result is to define different prototype cells. For example, you could define four different prototype cells, each one with a different layout like those shown in the example picture you provided. You can dequeue the appropriate cell based on the content you want to display so there is no need to adjust the layout in the code.
If you are doing everything in code, it's a lot more complicated since you have to build your own "layout engine" to adjust size and position of the views in your cell. You can have a look at XibFree or use MonoTouch.Dialog as suggested in the comments.

How to scroll cut off text iOS tableview like a moving banner

I have a tableview with dynamic data from a parsed xml file. I have set a default font size, and for most entries, it works okay. However, some have an entry that seems to be cut off.. and Apple simple adds "..." to the end.
Is there a way I can implement something like a slowly scrolling banner to accommodate this? And if not, is there a way I can make the text fit if it exceeds the size without making a global change to all entries?
I think for the slowly scrolling banner you would have to implement that yourself by animating your views.
If you don't expect your text to exceed the size by that much you could try using minimumScaleFactor in ios6:
[label setMinimumScaleFactor:.75f];
or minimumFontSizeSize for < ios6.
These essentially shrink the text to fit the frame.
p.s. you can configure these in interface builder

Resources