Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

slow button response

thephotographerthephotographer Posts: 157Registered Users
[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
- (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

-(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

- (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?
Post edited by thephotographer on

Replies

Sign In or Register to comment.