cocoa touch - iOS scroll view is not working -
i have button @ 1000 height pixel mark , need uiscrollview in order access button. implemented scrollview code below , shows scroll view ,but doesn't allow me scroll down. might missing key function. tips or advice appreciated.
uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0, 0, 320, 680)]; scrollview.contentsize = cgsizemake(320, 1000); scrollview.clipstobounds = yes; super.view.backgroundcolor = [uicolor whitecolor]; [scrollview setuserinteractionenabled:yes]; [[self view] addsubview:scrollview];
the problem button's y coordinate 1000 pixels, have stated. , y-coordinate of scrollview's contentzize maximum upto 1000 pixels well. scrollview can jus scroll button starts.
uibutton *btn =[uibutton buttonwithtype:uibuttontypecustom]; btn.frame = cgrectmake(50, 1000, 100,45); [scrollview addsubview:btn];
set content size of scrollview this
scrollview.contentsize = cgsizemake(320, 1100);
this surely solve it.