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.

How to create floating Segmented Button?

tomtom100tomtom100 Posts: 21Registered Users
For some social app, in user profile and its follower, following, favorites tabbar. How to create a floating segmented button so when the uiview scroll down, the segmented button stay on the top

--------------
User Profile --> this will be follow the scroll
Following | Follower | Favorites ---> This stay on the top as user scroll down
---------------------
UITableView/UIView

Replies

  • Duncan CDuncan C Posts: 8,032Tutorial Authors, Registered Users
    Simple. Put the segmented button in the parent view, not inside the scroll view. It can be located above the scroll view without being inside the scroll view. It can be tricky to do this in IB however. What I suggest doing is either


    a) drag your segmented control to a spot on your XIB that is not covered by the scrollview, and then double-clicking on it in the list of objects and use the arrow keys to move it on top of the scroll view without putting it inside the scroll view

    or

    b) Drag the segmented control from the list of UI objects in IB into the list of objects in your view controller, and into the parent view controller for the scroll view. Then double-click on it to select it and and move it with the arrow keys as above.

    Dragging the object into the hierarchical list (choice b above) lets you place it where you want it even if the scroll view completely covers the parent view.
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • tomtom100tomtom100 Posts: 21Registered Users
    Thanks. Good tip. The scenario might be good for static location for segmented control. What if the initial segmented in the middle. As the user scroll down, the segmented control follow the scroll up to the top and stay there
  • Duncan CDuncan C Posts: 8,032Tutorial Authors, Registered Users
    tomtom100 said:

    Thanks. Good tip. The scenario might be good for static location for segmented control. What if the initial segmented in the middle. As the user scroll down, the segmented control follow the scroll up to the top and stay there

    So you want the segmented control to start out in the middle of the scrolling area, then scroll up to the top of the scrolling area but not scroll away?

    That would take some custom code that would run off of the scroll view delegate methods. Take a look at the UIScrollViewDelegate Protocol Reference in the Xcode help system.
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • rmarlierermarliere Posts: 1New Users
    Did you find a solution for that? I'm trying to do the same thing.
Sign In or Register to comment.