iphone - Why is my UIScrollView horizontal scroll bar not showing? -


    cgfloat width = textfield.text.floatvalue;     cgfloat height = textfield2.text.floatvalue;     canvasview *canv = [[canvasview alloc]     initwithframe:cgrectmake((self.myscrollview.frame.size.width - width)/2, (self.myscrollview.frame.size.height - height)/2, width, height)];     [canv setbackgroundcolor:[uicolor whitecolor]];     self.canvas = canv;     [self.myscrollview addsubview:canv]; 

i using code add uiview @ runtime in uiscrollview , width , height parameter taken user @ runtime problem is:
if width , height more size of uiscrollview not showing horizontal scroll bar.

why this?

the problem seems lie contentsize of scrollview.

when width , height increases must change contentsize of uiscrollview accordingly.

it contentsize defines limits of scrollable content shown on scrollview.

scrollview.contentsize = cgsizemake(width, height); 

if in scrollview have uiview above line of code must work in case. otherwise need set contentsize accordingly include other uicomponents well.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -