Scrolling textview + scrollview problem

Discussion in 'iOS Programming' started by solinari6, Mar 26, 2014.

  1. solinari6 macrumors member

    Joined:
    Aug 13, 2008
    #1
    Hi, so I've got an issue I can't quite figure out, and am looking for advice.

    I've got a textview, that is on a scrollview. The textview is only a small part of the scrollview, and I've set the height of the textview to have enough room for around 3 lines of text. BUT, the textview can have much more than that, and should scroll to show the rest.

    The problem is, when I try to scroll the textview, it just scrolls the whole scrollview. I don't know what's wrong ... I definitely have scrolling enabled on the textview.

    Any ideas?
     
  2. IDMah macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #2
    I would detect when textview is active.

    Code:
    -(void)textFieldDidBeginEditing:(UITextField *)textField { //Keyboard becomes visible
     // Disable Scrollview ! //
        //perform actions.
    }
    or


    Code:
    if (textFieldSomething.isEditing) {
        ...
    }
    
    then re-enable it when they press else where to scroll.
    Just how I would do it.
     
  3. solinari6 thread starter macrumors member

    Joined:
    Aug 13, 2008
    #3
    I'm not sure I follow ... it isn't an editable field.. so it shouldn't have any keyboard showing up when they click on it.
     
  4. MattInOz macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #4
    Scrolling might be enabled but most likely the ParentScrollView is most likely canceling any swipe gestures. It would assume that it should be the only thing handling swipes so can cancel them.

    Either change the layout so top scroll view works with horizontal swipes leaving vertical for the textView. So neither compete for gestures or

    Or there might be a way to get the scrollview to pass on the swipe events and ignore them itself while in the region of the textView but it's not something i've tried so can't help you other than to say.

    Look at the Apple documents of Responder Chain for more on gestures and how they are handled.
     
  5. IDMah macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #5

Share This Page