Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-21-2011, 06:45 AM   #1 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 135
thephotographer is on a distinguished road
Default slow button response

[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?

Last edited by thephotographer; 11-21-2011 at 07:09 AM.
thephotographer is offline   Reply With Quote
Old 11-21-2011, 07:07 AM   #2 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 135
thephotographer is on a distinguished road
Default

ok, i have found the problem, if i comment out the double tap recogniser on the second uiscrollview, my buttons work perfect. i just added a delegate to the recogniser to ignore if the class is a uibutton, and now its perfect
thephotographer is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 391
14 members and 377 guests
7twenty7, chiataytuday, Clouds, dedeys78, Duncan C, e2applets, EvilElf, iekei, ipodphone, jeroenkeij, leostc, mbadegree, Murphy, QuantumDoja
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:33 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0