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
As the weather gets colder, whether in the north ...
The performance, appearance and advanced technolo...
Of course you know Song It is the main character ...
In the process of information flow advertising , ...
Produced by: Science Popularization China Author:...
Friends who often eat fruits will have this feeli...
Almost all e-commerce companies are considering o...
The mobile phone operating system has developed t...
AI has gradually moved from science fiction to re...
Today (8th), the State Council’s Joint Prevention...
How much does it cost to attract investment in th...
The Xiaomi box uses the Amlogic S802 processor, wh...
My name is Lao Huang. I am an operator. In fact, ...
The sun is the source of life and the symbol of l...