ios - UITextView in UIScrollView both inside another UIScrollView -


i'm adding series of text views inside scroll views scroll view. can draw first text view in scroll view. when attempt add second text view associated scroll view drawn bit text view not added. can point out i'm doing wrong here?

for (int = 0; < numberofviews; ++) {      cgfloat xorigin = * 230;     cgrect textrect = cgrectmake(xorigin, 0, 210, 250);     cgrect imagerect = cgrectmake(xorigin, 30, 210, 5);     cgrect subscrollrect = cgrectmake(xorigin, 40, 210, 250);      _image1 = [[uiimageview alloc] initwithframe:imagerect];     _image1.image = [uiimage imagenamed:@"horizontal_line_02.png"];      if (i == 0) {         _textview1 = [[uitextview alloc] initwithframe:textrect];         _textview1.delegate = self;         _textview1.userinteractionenabled = no;         _textview1.text = @"lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";         _subscrollview1 = [[uiscrollview alloc] initwithframe:subscrollrect];         [_subscrollview1 setcontentsize:cgsizemake(210, 500)];         [_subscrollview1 addsubview:_textview1];         [_textscrollview addsubview:_subscrollview1];         [_textscrollview addsubview:_image1];     }     else if (i == 1) {         _textview2 = [[uitextview alloc] initwithframe:textrect];         _textview2.delegate = self;         _textview2.userinteractionenabled = yes;         _textview2.text = @"lorem ipsum dolor sit amet, consectetur adipiscing elit. praesent accumsan elementum tempor. pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. integer sapien turpis, laoreet id ullamcorper sed, accumsan id ligula. etiam euismod, augue sed porta eleifend, mauris dolor scelerisque velit, ac facilisis libero elit et arcu. morbi ligula libero, porta id leo ut, convallis adipiscing enim.";         _subscrollview2 = [[uiscrollview alloc] initwithframe:subscrollrect];         [_subscrollview2 setcontentsize:cgsizemake(210, 500)];         [_subscrollview2 addsubview:_textview2];         [_textscrollview addsubview:_subscrollview2];         [_textscrollview addsubview:_image1];     } 

it seems use same textfield2 everytime. (so, you're releasing every iteration, should show last one.

instead of:

_textview2 = [[uitextview alloc] initwithframe:textrect];  

try :

uitextview *textview2 = [[uitextview alloc] initwithframe:textrect];  

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -