ipados 26 and xib

hi, i have an objc ipad application that use xib with zooming for adapt to the screen (until ios18) but with ipad os 26 will be displayed wrong

Answered by DTS Engineer in 844461022

Your code transforms the view using a scale that is hard coded based on a fixed screen size, which I'd strongly discourage. I understand that the project "was born in 2013 with objc and xib," yet the technologies have evolved quite a lot, and you probably don't want to continue to invest your time on your current approach.

As of today, folks are recommended to use Swift + SwiftUI to create their app UI. If switching to a new programming language and UI framework is too aggressive, you might consider adopting Auto Layout in your UIKit + xib + Objective C code, which should make your app automatically adapt different screen sizes and resolutions.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

For folks to help, you might consider providing more context about your question, for example, what Apple APIs you use and how you use them, how you trigger the issue, and what error message you get, if any. Screenshots to show the issue will also help. See tips on writing forums posts, if necessary.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Accepted Answer

sorry, i just attached sample... this project was born in 2013 with objc and xib, at the moment is over 300 views and use xib with a scaled zoom for adapt to screen size like:

 CGFloat scale=[[UIScreen mainScreen] scale];
    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    CGSize screenSize = CGSizeMake(screenBounds.size.width*scale,screenBounds.size.height*scale);
    
    
    // 2048 e 1536 sono le risoluzioni del retina
    CGFloat scalaX=screenSize.width/2048;
    CGFloat scalaY=screenSize.height/1536;

 if ((screenSize.width==1366) && (screenSize.height==1024))
    {
        scalaX=1.34;
        scalaY=1.34;
    }
    
    if (scalaX<1)
    {
        scalaX=1;
    }
    
    if ((scalaY<1) && (!((screenBounds.size.width*scale==2266) && (screenBounds.size.height*scale==1488))))
    {
        scalaY=1;
    }
    
    CGAffineTransform transform = CGAffineTransformMakeScale(scalaX,scalaY);
    self.view.transform = transform;
code-block

Your code transforms the view using a scale that is hard coded based on a fixed screen size, which I'd strongly discourage. I understand that the project "was born in 2013 with objc and xib," yet the technologies have evolved quite a lot, and you probably don't want to continue to invest your time on your current approach.

As of today, folks are recommended to use Swift + SwiftUI to create their app UI. If switching to a new programming language and UI framework is too aggressive, you might consider adopting Auto Layout in your UIKit + xib + Objective C code, which should make your app automatically adapt different screen sizes and resolutions.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

i try to update using autolayout but another issue is the new 3 buttons (close, hide and fullscreen) are over the uibutton inside ma left bar, is it possible create a margin when are showed?

ipados 26 and xib
 
 
Q