Autostart with the image, 2 labels, button - labels disappear after rotation

In a simple test application for iPhone, I am trying to display a custom phone in an image view (using SDWebImage via CocoaPods), two shortcuts and a Play button - each user interface element is under a different one, as shown in the screenshot:

app screenshot

I use Autolayout in Xcode 5 and set 20 pixels around each user interface element as shown in the screenshot (here fullscreen ):

Xcode 5 screenshot

My code in ViewController.m is short and simple:

- (void)viewDidLoad
{
    [super viewDidLoad];

    _firstName.text = @"Alex";
    _city.text      = @"Bochum";

    [_imageView setImageWithURL:[NSURL URLWithString:kAvatar]
               placeholderImage:[UIImage imageNamed:@"Male.png"]];
}

Unfortunately, my problem is that after rotation both labels disappear:

landscape screenshot

portrait screenshot

? , , " " " " ...

+4
3

, " " " " ( 250, ) - ( 750):

Xcode screenshot

( " " " " ), :

portrait screenshot

landscape screenshot

iOS, , , , , , ( setImageWithURL:placeholderImage: call to viewDidAppear ). , 5 - - , .

+4

1- , , 3,5- , 4- ipad, .

2 - , , , , , SDWebImage .

3 - , ( ), , , AutoLayuot , , .

, .

0

, , SDWebImage. , ( ). , , - , , .

[_imageView setImageWithURL:[NSURL URLWithString:kAvatar];

[_imageView setImageWithURL:[NSURL URLWithString:kAvatar]
           placeholderImage:[UIImage imageNamed:@"Male.png"]];

, .

:

    [_imageView setImageWithURL:[NSURL URLWithString:kAvatar]
           placeholderImage:[UIImage imageNamed:@"Male.png"]];

inside viewDidAppear for the restrictions to take effect. So it may not be SDWebImageBug in the end :)

0
source

Source: https://habr.com/ru/post/1538126/


All Articles