1. Adapt to 4 inch screen adaptation.
To adapt to the 4 inch screen, the system creates a default-568h@2x.png image and identifies whether the system supports the 4 inch screen based on the resource. As for other resources, xxx-568h.jpg is not allowed to be used to adapt to the screen. You need to use the code to detect the screen for adaptation.
2. uinavigationviewcontroller changes
As found during the development process today, the initwithrootviewcontroller of this class will eventually call the init method in previous versions. Therefore, when inheriting uinavigationviewcontroller, you can directly override the init method to initialize the required attributes of the object. However, the init method is not called on ios6, so developers need to pay attention to it.
3. cfrelease changes
In earlier versions, if cfrelease is allowed to pass in nil, it does not affect our program, but in ios6, in this way, the program directly drops your program crash, so you need to determine whether NIL is safe in the code.
4. uipickerview changes
In earlier versions, calling [_ pickerview selectrow:-1 incomponent: 0 animated: Yes]; is allowed. However, ios6 may cause a crash.
5. Changes in uiactivityindicatorview
In earlier versions, if the startanimating method is called, you only need to add the uiactivityindicatorview to the subview to display the loaded animation. However, in ios6, if you remove the display queue, the animation is stopped, this control is especially added to uitableviewcell. As long as the uiactivityindicatorview of the cell is rolled for several times, it disappears. To solve this problem, you can determine whether to execute an animation based on the isanimating attribute when adding the display queue, if not, call the startanimating method again.
6. Differences in obtaining the address book list
To obtain the address book list after ios6.0, you need to ask the user. After the user's consent, you can obtain the address book user list. In addition, the initialization of abaddressbookref is also changed from the abaddressbookcreate function to the abaddressbookcreatewitexceptions function. The following code is compatible with the previous version to obtain the address book user list.
[CPP]
View plaincopyprint?
- + (Nsarray *) abcontacts {
- Float version = [uidevice currentdevice]. systemversion. floatvalue;
- Nsmutablearray * ret = nil;
- If (version> = 6.0)
- {
- Nslog (@ "get contacts by> = 6.0 API ");
- Abaddressbookref addressbook = abaddressbookcreatewitexceptions (nil, nil );
- // Execute the code below after waiting for consent
- Dispatch_semaphore_t Sema = dispatch_semaphore_create (0 );
- Abaddressbookrequestaccesswithcompletion (addressbook, ^ (bool granted, cferrorref error)
- {
- Dispatch_semaphore_signal (SEMA );
- });
- Dispatch_semaphore_wait (Sema, dispatch_time_forever );
- Dispatch_release (SEMA );
- Cfarrayref ppref = abaddressbookcopyarrayofallpeople (addressbook );
- Ret = [nsmutablearray array];
- For (ID record in (nsarray *) ppref ){
- @ Try {
- Contact * Contact = [contact contactwithabrecordref: Record];
- // Nslog (@ "contact name = % @", contact. compositename );
- [Contact initforsearchwithrecord: Record];
- // Nslog (@ "init for search ");
- [RET addobject: Contact];
- }
- @ Catch (nsexception * exception ){
- }
- @ Finally {
- }
- }
- Nslog (@ "AB size = % d", [RET count]);
- Cfrelease (ppref );
- Cfrelease (addressbook );
- } Else {
- Nslog (@ "get contacts by <6.0 API ");
- Abaddressbookref addressbook = abaddressbookcreate ();
- Cfarrayref ppref = abaddressbookcopyarrayofallpeople (addressbook );
- Ret = [nsmutablearray array];
- For (ID record in (nsarray *) ppref ){
- @ Try {
- Contact * Contact = [contact contactwithabrecordref: Record];
- // Nslog (@ "contact name = % @", contact. compositename );
- [Contact initforsearchwithrecord: Record];
- // Nslog (@ "init for search ");
- [RET addobject: Contact];
- }
- @ Catch (nsexception * exception ){
- }
- @ Finally {
- }
- }
- Cfrelease (ppref );
- Cfrelease (addressbook );
- }
- Return ret;
- }