Because my project to adapt to iOS7.1, and now is 9 times, in the actual work I also met a variety of wonderful pits, so I would like to meet the iOS7 adaptation problems and solutions to share out, later these things may be of little use.
1. Font problems
Font adaptation in IOS7 I'm afraid it's the most troublesome pit, because many of the fonts above iOS7 are not present in 7, even including some system-fonts. For example System-black, if you use black, in the 7 above the black body display no problem, but in 7 to become a hollow display, and you change it to System-medium, there will be the word is cut magic phenomenon, The reason is that there is no system-black at 7, there is a problem with font rendering. So use the font to be careful, if you must use System-black, you can use System-medium instead, or do similar to the following compatibility:
8 ? [Uifont systemfontofsize:]: [Uifont systemfontofsize: Weight:uifontweightmedium ];
In addition, if you load a non-existent font in storyboard or xib, the page loaded into this storyboard will become unusually slow, because the system will traverse the entire font library to find a nonexistent font and find that he can only replace it with system. So don't try to load fonts that aren't in your project.
In addition, the default font in the iOS9 becomes the San Francisco font, instead of the earlier Helvetica font, there are some differences in style, font height and text layout are also different, if your label is written dead height constraints to note, after the update to IOS9, Your content will look like it was cut off from the top. As there are a lot of 9 matching information on the Internet, we will not repeat it here.
2. Animation issues
The IOS7 animation has a timing problem. The simplest of a scene is, click on the pop-up of a actionsheet,actionsheet, the same time, pops up a alertview, if the two animations at the same time, Alertview may blink and disappear, it may be normal display, Depends on the length of the text content in the Alertview. If the text content is more, cause alertview layer too late to render, Alertview will flash disappear. The solution is at the end of the Actionsheet dismiss animation, and then the alertview,dismiss can be monitored with an agent method:
-(void) Actionsheet: (Uiactionsheet *) actionsheet Diddismisswithbuttonindex: (Nsinteger) Buttonindex { // show Alertview here!}
3.UILabel
IOS7 , if you do not set a height constraint or assign a value to a label, the height defaults to 0 when there is no content in the label, andafter iOS 7 , even if the label has no content, Automatically gives a corresponding height according to the height of the label's default fontsize. Note that this can avoid problems with layout.
4.viewdidlayoutsubviews
This method in iOS7 may cause a crash, and a secure handling is to add [Self.view layoutsubviews] at the end of the Viewdidlayoutsubviews method;
5.UIButton
IOS7 the title of the button 's normal and selected states is separate, and the normal setting does not set the title of the selected , you need to set it separately.
Now can think of so much, welcome to add ~
A discussion on various iOS7 adaptation problems in the project