Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

ios - Content of UIscrollview not updating, when changing orientation

Here's my problem.
Am Using a scrollview whose Frames I am changing when rotating the device.

I have 8 AsyncImageView on that scrollview. And the Images on AsyncImageView's are set by calling web services.
Project runs fine. Images on the AsyncImageView are loaded properly.

But when I rotate the device, AsyncImageViews shows no Images. I tried everything. No success. Then I used a trick. That is setting the scrollview content offset 1,0 when rotating in either direction.

And my project works fine. All the Images are shown properly. It looks my scrollview doesn't refresh when I change the rotation, But as I set its offset 1,0 ; It started showing Images on AsyncImageView properly. Is there any thing I missed regarding Uiscrollview?

I used

[self.scrollView setNeedsDisplay];  

I applied few other things too, found on stackoverflow and google, nothing worked in my case. Please help.

Here's the code

//Magazine Images
            //subview1 MAG Imaegs
            [[asy_Array_Mag_sub1 objectAtIndex:0] setFrame:CGRectMake(59, 120, 136, 174)];
            [[asy_Array_Mag_sub1 objectAtIndex:1] setFrame:CGRectMake(296, 120, 136, 174)];
            [[asy_Array_Mag_sub1 objectAtIndex:2] setFrame:CGRectMake(576, 120, 136, 174)];
            [[asy_Array_Mag_sub1 objectAtIndex:3] setFrame:CGRectMake(802, 176, 136, 174)];
            [[asy_Array_Mag_sub1 objectAtIndex:4] setFrame:CGRectMake(57, 465, 136, 174)];
            [[asy_Array_Mag_sub1 objectAtIndex:5] setFrame:CGRectMake(296, 383, 136, 174)];
            [[asy_Array_Mag_sub1 objectAtIndex:6] setFrame:CGRectMake(570, 377, 136, 174)];
            [[asy_Array_Mag_sub1 objectAtIndex:7] setFrame:CGRectMake(802, 486, 136, 174)];


            [self.otlScrollView setFrame:CGRectMake(0, 0,  1024, 768)];

            self.otlScrollView.contentSize = CGSizeMake(1024 * total_pages, 768);



            [_otlSubView setFrame:CGRectMake(a1, 0, 1024, 768)];
            [self.otlScrollView addSubview:_otlSubView];
            [_otlSubView2 setFrame:CGRectMake(b1, 0, 1024, 768)];
            [self.otlScrollView addSubview:_otlSubView2];
            [_otlSubView3 setFrame:CGRectMake(c1, 0, 1024, 768)];
            [self.otlScrollView addSubview:_otlSubView3];





            [_otlScrollView setContentOffset:CGPointMake(1024 * (self.otlPageControl.currentPage), 0)];
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...