Ui adaptation for iOS 6 and iPhone 5

Source: Internet
Author: User

Every time Apple releases a system, developers are busy working for a while, updating xcode to adapt to the new system: for example, ios4 supports retain and requires @ 2x; for example, ios5 does not support udid; for example, iOS 6 and iPhone 5 face the following problems.
1. Add retina 4 launch image, and you will be prompted when running the project.
Click Add directly at this time. A default-568h@2x.png black image will be created:

If this parameter is not added, the program will be running with black borders.

Effect after adding

In this case, I would like to say that when the first time transparency says that we want to add such a picture to the group, my first response is: Isn't there a black picture when the program starts? However, my program does not need to start the graph. This worry is unnecessary only when you add this image. It is estimated that Apple has made some optimizations. when it determines that the image is a black image, it will be skipped directly.
2. Group Table view background color is deprecated in IOS 6.0

When using the background color, the color that comes with my favorite system is: "group table view background color ". Now that the color is gone, you can change it to another color.
3. About multiple targets
Upload File, drag it to the corresponding "Copy bundle resources.

Note that when multiple targets are running on the simulator, they are not as convenient as they were before. You can directly switch the configuration file to run them. When testing different target representations, in addition to switching the configuration file, you also need to clear the simulator ~
4. xcode4.5 no longer supports armv6, that is, systems below ios4.3.3.
Unsupported hardware devices include: IPOD 2nd Gen, iPhone 3G or older iPhone
For example, the error message during packaging is:

  warning: iOS deployment targets lower than 4.3 are not supported (current IPHONEOS_DEPLOYMENT_TARGET ="4.0", ARCHS ="armv7").(null):  iPhone/iPod Touch: application executable is missing a required architecture.  At least one of the following architecture(s) must be present: armv6 (-19033)

Because I like to use block, I developed Dongdong, which generally supports ios4.0 at the lowest level. It seems that Apple is forcing developers and users to upgrade.
5. Provide a piece of code to judge the iPhone?

  #define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

When using it directly?

  if
(iPhone5) ooxx

You can.
In addition, if the code is written to the interface, the view height in iPhone 5 is 568 ~
6. Questions about XIB adaptive
By default, if your interface contains scrollview/tableview, this interface basically does not need to be changed because the middle branch is automatically stretched. If these two full-screen controls are not included, you may need to add another XIB for iPhone 5. The method is simple. Create an XIB file and set the View Size to retina 4 full screen. I have already mentioned how to judge iPhone 5 and how to read different XIB files without using code?
7. About screen rotation (I went through the ios5 one time and this time)
To thoroughly understand this problem, you also need to do some experiments yourself. ios6 canceled an API and added two APIs, but this one cannot meet my needs: the application is a portrait screen on all interfaces and only a landscape screen on one screen. It takes me half a day to complete this situation. Let's just talk about how to implement it.
First, the view in the XIB of the horizontal screen is horizontal.
Second, screen adaptation only supports landscape screens?

  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
  returnUIInterfaceOrientationIsLandscape(interfaceOrientation);}

Third: The view is present.
Fourth: Hide the status bar in viewdidload?

  - (void)viewDidLoad
{
  if(IOSSystemVersion >= 5.0)
 {
    // 5.0 and later, if this is not completed, and the interface is misplaced and the animation is taken, it is easy to see a white head    [[UIApplication sharedApplication] setStatusBarHidden:YES];  }}

Fifth: viewwillappear rotate the view 90 degrees by itself?

  - (void)viewWillAppear:(BOOL)animated
{
  [superviewWillAppear:animated];  [UIView animateWithDuration:0.0f                   animations:^{                     [self.view setTransform: CGAffineTransformMakeRotation(M_PI / 2)];                     if(iPhone5) {                       self.view.frame = CGRectMake(0, 0, 568, 320);                     }                     else{                       self.view.frame = CGRectMake(0, 0, 480, 320);                     }                   }];}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.