0

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)];
Jasmeet
  • 1,522
  • 2
  • 22
  • 41
  • Can't you just tap on enter on your keyboard ? It's unreadable like it... – Tancrede Chazallet Feb 18 '14 at 16:33
  • 1
    @AncAinu I have updated my code now. But its very Bad(-2) to Give a thumb down to starters – Jasmeet Feb 18 '14 at 16:43
  • It's not bad if the guy who do it put a comment to say why (first of all, I hate guys who doesn't assume), and remove it once the problem is solved ;) – Tancrede Chazallet Feb 18 '14 at 16:46
  • Can you provide more code about your `UIScrollView` declaration and your rotation ? – Tancrede Chazallet Feb 18 '14 at 16:57
  • @AncAinu I took scrollview using drag and drop. when rotating I wrote following code for changing its frame [self.otlScrollView setFrame:CGRectMake(0, 0, 768, 1024)]; – Jasmeet Feb 19 '14 at 03:39
  • can you really provide code (edit your answer and copy paste lines of your declaration and rotation), you can change the names if there is something secret. But we are here to help, if you doesn't copy code we can't. – Tancrede Chazallet Feb 19 '14 at 09:58
  • @AncAinu I have added the Code now. Please tell, any other Information required. Thank you – Jasmeet Feb 19 '14 at 10:08
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47837/discussion-between-jeev-and-anc-ainu) – Jasmeet Feb 19 '14 at 10:20

0 Answers0