This code block not executing as desired as some times instead of itemsPerRow it returns (itemsPerRow - 1) columns in a row (vertical scrolling)
We need to do something like (widthPerItem - K) where K value is only able to find through hit & trials to get exact itemsPerRow
Any exact solution for that ?
Question about the activity indicator as a subView in the uiTextField. Is adding a new instance of an indicator view as a subview and then removing it from the superview the most efficient method? Wouldn’t it be more efficient to subclass uiTextField and then have the appropriate logic to active/inactive/hide/unhide the activity view? Just wondering.
If you’re going to be adding the subview back to the superview soon after it’s removed, its probably best to use the isHidden property. Likewise if you have many subviews coming and going or one that will be gone for a long period of time, you should remove it.
In this case either would work. This is the code required to use isHidden inside the Text Field Delegate:
Thanks for reading, and welcome to the forums! We usually group functions into extensions when those functions are part of a protocol. It keeps your code organised and helps you identify parts than could maybe form a separate object or type later on.