Don't wanna be here? Send us removal request.
Text
Solutions to Address Uiscrollview Optimization Problems

Shaded shadows: shadows rendering for UIView Using shadows in the drawing area, you can create a 3D effect that highlights certain elements. This approach is well known and very popular. In most cases, using the default method for adding shadows to objects in the cell will not cause any problems. However, when the cell and the UIScrollView suboviews become overloaded, such an approach reduces the fluidity of scrolling. The problem is that the shadow is calculated using the value of the alpha channel of each pixel of a given UIView, which reduces the rendering of frames per second (FPS). For more information contact with
Mobile App Developer in Austin
. Solution: use shadowPath To avoid these problems, you must use shadowPath when adding the shadow. In this way, you can make the shadow using a specific shape and gradient, which is significantly faster than the pixel-by-pixel calculation process. Views that fail when hiding: rendering shadows for UIView (hidden version) The next performance problem of UIScrollView occurred during the test on the iPhone 6 Plus / 6s Plus / 7 Plus, where the scrolling was reduced. The main animation tool has confirmed a decrease in the refresh rate (FPS) from averages of 55 to 35 on screens with problems displaying the content. When looking for a solution, the team found that the problem was known to these devices and that it was possible to disable transparency in iOS settings. Solution 1: Turn off the shadows The first solution is to disable shadows when UIView is not visible by setting a value of 0 for the shadowOpacity parameter. Although this solution is the simplest and most convenient option if you have a clear visual control system, it is not very versatile. Solution 2: Use shadowPath The second option is to use shadowPath for shadow, which makes rendering much easier. Further requirements can be found in the responsiveness of UIView, animation, and other processes associated with coordinate transformation because it is necessary to support UIBezierPath changes. Content scrolling selection of content: including UIScrollView and UITableView Another task that we encountered and solved during this project was to implement embedded UIScrollView to create a navigation similar to that used in Media, Twitter and IMDb. We had to create a header with general information, a tabbed panel with variable tabs (fixed at the top of the screen while scrolling) and an area with a horizontal UIScrollView containing pages in the form of vertical tables. Solution: use the container The solution to this problem is described in detail in an article by Daniele Margutti entitled "Efficient Scrolling of UIStackView in Swift". The main task of the article is to perform these steps: Implement a delegate of the main UIScrollView function, in particular the scrollViewDidScroll (_ scrollView: UIScrollView) method. Places visible content in views that are containers. Containers must have a FrameSize equal to the size of the content. This allows you to calculate the correct offset size and value of the UIScrollView main view. Calculates the visible portion of the table after each change in the parent UIScrollView offset. Keep the table size of the table less than or equal to the size of the device display. Change frame.origin and contentOffset of the internal UIScrollView to move the visible part and adjust it to the visible part of the parent UIScrollView. Conclusion: the warning is ready Although UIScrollView and UITableView have relatively simple and understandable functional principles, optimization problems are still evident. They can also occur in the case of small deviations in the use of standard component flow.
0 notes