During the development process, we will always encounter various small problems, some of which are not very easy to solve. Here I will summarize the various small problems I encountered during development and my solutions. I will not mention the more common ones, but mainly talk about some that you may not know (of course, it is also possible that you know them all, so you don't need to read on) 1. Local rounded corners of controls Have you ever encountered this problem: a button or label only has two rounded corners on the right, or only one rounded corner? What should you do? This is where layer masks come in handy.
For example, button, other controls inherited from UIView can 2. Transparency issue of navigationBar If you only set the alpha of the navigationBar to 0, it is equivalent to hiding the navigationBar. As we all know, if the alpha of the parent view is set to 0, all the child views will be transparent. Then the title and the left and right buttons of the corresponding navigationBar will disappear. This obviously does not achieve the effect we require. (1) If you only want the navigationBar to be transparent, and both the button and title are available, you can use the following method:
If you are careful, you will find that there is a line as shown below: This requires us to do further processing and remove the line, as follows:
(2) If you want to achieve the effect of changing from transparent to opaque based on the pull-down distance, then the above method will not be enough, so we need to use another method.
3. Globally set the style of the navigationBar title and the barItem title style
4. Transition of hiding and displaying navigationBar I believe you must have encountered this situation during use: one page hides the navigationBar, while the other does not. When the two pages are pushed or popped, especially when there is a side swipe gesture to return, if no processing is done, the navigationBar position will be empty when sliding back, and a black screen or the view below will be displayed directly, which is ugly. In this case, we need to add a transition animation to hide or show the navigationBar: Implement the viewWillAppear method on the page that will appear after returning. Set it to YES if you need to hide it, and set it to NO if you need to show it.
5. Slide back The side-slide back gesture of iOS has a good operating experience. An application that does not support the side-slide back is definitely not a good application. However, during the development process, when the back button is customized, or some webView, tableView and other pages, the side-slide back gesture fails. At this time, we need to set it up. You can negotiate the following code in the base class:
Problem: When you return to the topmost controller of the navigationController and swipe sideways again, if you click on an operation that pushes a page, you will find that it is stuck and takes a long time to respond. This is because the gesture is still valid in the top-level Controller, but after sliding, you can't find the page you returned to. This causes the software to freeze and freeze, so you need to disable this gesture in the rootViewController. Set the following to NO self.navigationController.interactivePopGestureRecognizer.enabled = YES; Of course, you can also use a third-party library, which is very well written. It expands the system's side-swipe back gesture. Instead of sliding from the edge, you can just swipe right to return. Most importantly, it only needs to be added to the project, and it can be implemented without a single line of code. Attached is the github URL https://github.com/forkingdog/FDFullscreenPopGesture 6. Add a header view to webView WebView is a composite view, which contains a scrollView, which contains a UIWebBrowserView (responsible for displaying the content of WebView)
7. Animation settings for modal jump Set the animation of modal jump. The system provides four options
8. Image processing only gets part of the image
9. Set the image for UIView
10. Add simple animation to the cell of TableView or CollectionView Just animate the cell to be displayed in the willDisplayCell method:
|
<<: Lock the CPU frequency of Android devices
Expert of this article: Liu Yadan, researcher, de...
Nokia launched three Android phones last month, bu...
A few days ago, a nutritionist on a health progra...
As International Women's Day approaches, what...
Many people only see short videos and public acco...
Lockheed Martin has officially launched a bid to ...
1. Iron Man Dadong: After the film market boom du...
No more curling! BMW announced that it will offic...
In the confrontation with Apple, Samsung has alwa...
I believe that many of these cuties are “little r...
Abstract: The promotion of information apps repre...
Students who have listened to my speech must be i...
Have you noticed that some products become popula...
Hilarious Rice Circle [Audio] Hilarious Rice Circ...
This article introduces the product features and ...