One day, our product owner requested the following: “I want to make our application more exciting and visually attractive, by slightly changing the design”.
Our task:“Create rounded corners over the UITabBar”
The first approach: Set cornerRadius in all our the controllers of the UITabBarController:
But the result was as expected: Rounded corners on top of my views as well:
The second attempt: Use masks
1 2 3 4 5
After some research, we understood that each controller in our UITabBarController is a UINavigationController. As result, rounded corners disappear after pushing any next controller. The third try: We applied it for all main views. We created an extension of UIView and used it where it is required.
1 2 3 4 5
Cool, seems it worked! However, after testing we understood that it didn’t work with the UIScrollView, since you can see a black area while scrolling.
Finally, we decided to recalculate the mask path for UIScrollView:
1 2 3 4 5 6
And yes, it worked! No bugs or issues.
This solution worked for us. If you have any alternatives, please leave in comments.