[solved] how can i edit the thread title?
Hi,
i am having a slow button response, when i push a button, the button turns dark for about a second, then as soon as it returns normal the code is executed, which takes only 0.0014 seconds to execute the code in the buttonPressed selector. I'm not sure why the delay is there though. my view hierarchy goes something like this
main window > uiview1 > uiscrollview1 (paging) > uiscrollview2 (zooming) > uiview2 > uiview3 >uibutton.
If i place the button as a subview of uiview 1, or uiscrollview1, the button performs great. as soon as the button is placed as a subview of scrollview2 or any subviews of scrollview2, there is the 1 second delay.
scrollview1 is a custom subclassed UIScrollview
Code:
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
self.delegate = self;
self.canCancelContentTouches = YES;
self.delaysContentTouches = YES;
self.pagingEnabled = YES;
self.scrollEnabled = YES;
self.alwaysBounceHorizontal = YES;
}
return self;
}
the custom subclass is for cancelling paged scrolling if the subview is a particular class
Code:
-(BOOL)touchesShouldCancelInContentView:(UIView *)view
{
if ( [view isKindOfClass:[ClassType1 class]]
|| [view isKindOfClass:[ClassType2 class]]
)
return NO;
else
return YES;
}
the 2nd uiscrollview is a normal UIScrollView class, and has an init as follows
Code:
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
self.contentSize = CGSizeMake(self.frame.size.width, self.frame.size.height);
self.pagingEnabled = NO;
self.scrollEnabled = YES;
self.showsVerticalScrollIndicator = NO;
self.showsHorizontalScrollIndicator = NO;
self.bounces = NO;
self.delegate = self;
self.maximumZoomScale = 3;
self.minimumZoomScale = 1;
self.canCancelContentTouches = YES;
self.delaysContentTouches = NO;
[self setBouncesZoom:NO];
}
return self;
}
If i make either of the delaysContentTouches to yes, instead of no, the buttons perform instantly, but then my content in the scrollview doesnt work correctly, the touch drag goes to dragging the scrollview instead of the touch going to my subviews. so i cant fix it by making delaysContentTouches = YES.
also i noticed if i touch the buttons with 2 fingers instead of 1 they perform instantly.
does anyone have any ideas?