-1

I need to create a new view for an app where the user is presented with a screen with a status bar, a text bubble and several buttons. They will be allowed to slide the text bubble off the screen and a new one will slide in to take its place. I only want the user to be able to move one bubble at a time. Where can I find a guide for coding something like this?

1) I have not done anything touch based, but I've heard of using UI Gesture Recognizers. 2) I need to know how to slide in the text bubble (which will have dynamically generated text) but not slide out the entire view. There are going to be buttons and status bars on the main window, so those have to stay, while the user is sliding through the text bubbles

Mark S
  • 2,161
  • 3
  • 21
  • 25
  • 1
    Have you tried anything yourself? Is there any code you are having trouble with, or a specific part of the documentation that you don't understand? – Abizern Sep 20 '12 at 15:26
  • Woops! I made myself seem like a complete idiot in the original post. This is working on an existing app that I've already been working on for a couple of weeks. I just haven't done anything with animation and am trying to figure out a good way to slide these text bubbles on and off the screen. I have not done any animation in iOS coding - only more back end stuff and facebook APi interaction. So, I'm super green to this end of things. – Mark S Sep 20 '12 at 16:13

1 Answers1

1

You can use UISwipeGestureRecognizer to detect when the user flickes his finger over the screen:

UISwipeGestureRecognizer *rec = [[UISwipeGestureRecognizer initWithTarget:self action:@selector(swipeDetected:)];
[someView addGestureRecognizer:rec];
[rec release];

Then you can use UIView animations to slide in any view:

[UIView animateWithDuration:0.5 animations:^{
    CGPoint ctr = textBubble.center;
    ctr.x += 100;
    textBubble.center = ctr;
}];

See UIGestureRecognizer and UIView class reference for further info. You also might find this link useful.

  • Sliding in a different view does not appear to be what I want. I'm looking specifically for the ability to animate a sliding text box coming on and off the screen based on a screen gesture. I want the user to be able to drag the existing textbox off the screen and a new one will come on from the other side of the screen to take its place. Unless views can be textboxes and embedded within views (I'm still not sure how View / Window architecture work so I'm reading up on it), I don't think I'm looking for what you're talking about (except the gestures). – Mark S Sep 20 '12 at 16:17
  • @MarkS text views and text fields are subclasses of UIView. Please read the documentation. –  Sep 20 '12 at 16:21