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-22-2011, 01:00 PM   #1 (permalink)
Crafty Veteran
 
Magic Hands's Avatar
 
Join Date: Nov 2008
Location: Memphis, TN
Age: 23
Posts: 436
Magic Hands is on a distinguished road
Send a message via Skype™ to Magic Hands
Default UIScrollView loss of reponse

I have a UIViewController. Within that is a UITableView which is drawn at origin 0,0. I also have a UIScrollView that is drawn at 0,-80 so that it is off screen and not visible.

When a menu button is pressed, I animate the UIViewController's frame down 80px to reveal the UIScrollView.

The problem here is that the UIScrollView does not respond at all.

If I draw the UIScrollView at say 0,0 , where it IS visible on load, it works fine. I can even animate it off screen then back on screen with no issue.


----------


Here is how my view looks before animating:
Code:
     _____________________________
    |                             |  Frame -> (0,-80, 320, 80)                  
    |      ScrollView             |  **Offscreen**
    |_____________________________|
    |                             |  <- Original view (0,0,320,480)
    |                             |
    |                             |
    |                             |
    |                             |
    |                             |
    |       Original View         |
    |                             |
    |                             | 
    |                             |
    |                             |
    |                             |
    |                             |
    |                             |
    |                             |
    |                             |
    |                             |
    |_____________________________|
----------

When I animate I do the following:

Code:
 [UIView animateWithDuration:0.3 
                          delay:0.0 
                        options:(UIViewAnimationOptionAllowUserInteraction |
                                 UIViewAnimationOptionCurveEaseIn) 
                     animations:^{ 
                             self.view.frame = CGRectMake(0.0, (self.view.frame.origin.y + container.frame.size.height), self.view.frame.size.width, self.view.frame.size.height);
                            scroll.userInteractionEnabled = YES;
                         } 
         
                     completion:^(BOOL finished) { 
                             if (scrollLoaded == NO) {
                                 [self loadFavorites]; 
                                 scrollLoaded = YES;
                             }
                         }];
----------

Now my view looks like this after animating:


Code:
  
     _____________________________
    |                             |  Frame -> (0, -80, 320, 80)              
    |      ScrollView             |  
    |_____________________________|
    |                             |  <- Original view (0, 80, 320, 480)
    |                             |
    |                             |
    |                             |
    |                             |
    |                             |
    |       Original View         |
    |                             |
    |                             | 
    |                             |
    |                             |
    |                             |
    |                             |
    |                             |
    |_____________________________|
    |                             |
    |        **Offscreen**        |
    |_____________________________|
----------

I have subclassed my scrollView to listen more closely for events:

**.h**

Code:
 #import <UIKit/UIKit.h>
    
    @interface UIScrollView_ExtraTouch : UIScrollView
    
    @end
**.m**

Code:
 #import "UIScrollView+ExtraTouch.h"
    
    @implementation UIScrollView_ExtraTouch
    
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
        NSLog(@"scrollview touchesBegan");
        [self.nextResponder touchesBegan:touches withEvent:event];
    }
    
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
        NSLog(@"scrollview touchesMoved");
        if(!self.dragging){
            [self.nextResponder touchesMoved:touches withEvent:event];
        }
    }
    
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
        NSLog(@"scrollview touchesEnded");
        [self.nextResponder touchesEnded:touches withEvent:event];
    }
    
    @end
----------


Nothing goes to the log after the animation. Which I think means that since the frame is at -80, it believes it to be off screen, thus not receive any type of action.

Is this correct? If so is there a way to fix it?
__________________
Magic Hands is offline   Reply With Quote
Old 11-23-2011, 12:42 AM   #2 (permalink)
Crafty Veteran
 
Magic Hands's Avatar
 
Join Date: Nov 2008
Location: Memphis, TN
Age: 23
Posts: 436
Magic Hands is on a distinguished road
Send a message via Skype™ to Magic Hands
Default

I think that I might have found an answer.

I am going to create a container view that is 560 to hold the views. That away I won't have to draw anything at a negative y value.
__________________
Magic Hands 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: 397
16 members and 381 guests
7twenty7, chiataytuday, Clouds, dedeys78, Duncan C, e2applets, EvilElf, iekei, ipodphone, jeroenkeij, leostc, mbadegree, Murphy, QuantumDoja, sacha1996, Sami Gh
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:34 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0