iphone - UIScrollView Horizontal scrolling - Disable left scroll -
how can disable scrolling left on uiscrollview. users can scroll right?
thanks
*** update *****
this have now. have subclassed uiscrollview , overwritten following methods
@implementation touchscrollview - (bool)touchesshouldbegin:(nsset *)touches withevent:(uievent *)event incontentview:(uiview *)view { nslog(@"touchesshouldbegin: touched!"); return yes; } - (bool)touchesshouldcancelincontentview:(uiview *)view { nslog(@"touchesshouldcancelincontentview: touched!"); return no; }
in viewcontroller have set following attributes:
scrollview.delayscontenttouches = no; scrollview.cancancelcontenttouches = yes;
touchesshouldbegin being called touchesshouldcancelincontentview not being called , cant figure out why!!
thanks
just add in uiviewcontroller uiscrollviewdelegate
float oldx; // here or better in .h interface - (void)scrollviewdidscroll:(uiscrollview *)ascrollview { if (scrollview.contentoffset.x < oldx) { [ascrollview setcontentoffset: cgpointmake(oldx, ascrollview.contentoffset.y)]; } else { oldx = ascrollview.contentoffset.x; } }
Comments
Post a Comment