MLQ
MLQ

Reputation: 13511

How to replicate Facebook's compose status screen for iOS?

Compose status message UIView in Facebook for iOS

I'm trying to build a compose status screen for my app and I'm looking at Facebook for iOS for inspiration. Above is their compose status screen.

I understand that the top is simply the navigation bar, the bottom can be a simple view with buttons in it (I will actually just have the camera and location icons). However, I can't quite figure out what UI components make up the full-screen UITextView in the middle. I'm trying to replicate it, except without the profile pic on the upper left.

When you type a status message, it looks like an ordinary UITextView. However, when you tag a location, the -- at (name of location) is appended to the UITextView and moves with the end of your status as you type along. Now, I don't think that's a UITextView feature. Also, the location text is not editable. Even more so, -- at is not clickable, yet the location itself, in blue (in this case, Starbucks Coffee), is.

As for the photo attachment, I can imagine that it is simply a UIImageView added via addSubview to the parent view which contains it and whatever makes up the status and location altogether. My question is, exactly what makes them up?

What I've tried: Well I haven't really coded anything, but I've been looking around and checking out Core Text for a possible implementation. However, it doesn't feel like the right tool to use because the status message needs to be editable. As I understand, Core Text is useful only for rendering something like the location tag, but not editing text like the status message itself.

Upvotes: 2

Views: 310

Answers (1)

Dmitry Shevchenko
Dmitry Shevchenko

Reputation: 32404

For advanced text view, take a look at UITextInput protocol, it's pretty powerful and could give you what you need.

Upvotes: 1

Related Questions