iphone - UIPickerView is not scrolling when added to UIScrollView! -
i have added uipickerview uiscrollview upickerview not scrolling. when add self.view scrolls smoothly. here code
monthsarray = [[nsarray alloc] initwithobjects:@"jan",@"feb",@"mar",@"apr",@"may",@"jun",@"jul",@"aug",@"sep",@"oct",@"nov",@"dec",nil]; uipickerview *objpickerview = [[uipickerview alloc] initwithframe:cgrectmake(185,350,100,100)]; objpickerview.userinteractionenabled=yes; objpickerview.delegate = self; objpickerview.showsselectionindicator = yes; [objscrollview addsubview:objpickerview];
i have included delegete , methods. have on issue. in advance.
if not clear please tell me.
i using subclass of uipickerview same purpose, mine simpler:
@implementation scrollablepickerview - (uiscrollview *)findscrollablesuperview { uiview *parent = self.superview; while ((nil != parent) && (![parent iskindofclass:[uiscrollview class]])) { parent = parent.superview; } uiscrollview* scrollview = (uiscrollview *)parent; return scrollview; } - (uiview*)hittest:(cgpoint)point withevent:(uievent*)event { uiscrollview* scrollview = [self findscrollablesuperview]; if (cgrectcontainspoint(self.bounds, point)) { scrollview.cancancelcontenttouches = no; scrollview.delayscontenttouches = no; } else { scrollview.cancancelcontenttouches = yes; scrollview.delayscontenttouches = yes; } return [super hittest:point withevent:event]; } @end
works charm - @ least me.
Comments
Post a Comment