Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What UI element in Cocoa Touch is this?

Tags:

cocoa-touch

I see this in the mail application on my iPod Touch and I'm wondering if this is a UI element. If not, how can I reproduce it?

enter image description here

like image 248
blake305 Avatar asked May 30 '12 01:05

blake305


People also ask

Which operating system has Cocoa Touch as its user interface?

Cocoa and Cocoa Touch are the application development environments for OS X and iOS, respectively. Both Cocoa and Cocoa Touch include the Objective-C runtime and two core frameworks: Cocoa, which includes the Foundation and AppKit frameworks, is used for developing applications that run on OS X.

What is Cocoa Touch in HCI?

The Cocoa Touch layer contains key frameworks for building iOS apps. These frameworks define the appearance of your app. They also provide the basic app infrastructure and support for key technologies such as multitasking, touch-based input, push notifications, and many high-level system services.

What is the Cocoa Touch API?

Cocoa Touch is based on the macOS Cocoa API toolset and, like it, is primarily written in the Objective-C language. Cocoa Touch allows the use of hardware and features that are not found in macOS computers and are thus unique to the iOS range of devices.

Is UIKit part of cocoa?

UIKit is one of the frameworks in cocoa touch.


1 Answers

On the desktop, that'd be called a "token field." They first appeared in Mail.app, and eventually became part of the AppKit framework. Documentation here.

It should be pretty easy to reproduce that look in Cocoa Touch. In Cocoa Touch, every view is backed by a Core Animation layer, and layers have a cornerRadius attribute. Set that attribute to half the height of the field to create rounded ends. You can set a background color if you're okay with a flat appearance, or you can draw a subtle gradient to give a more convex appearance.

Of course, you only need to do all that if you want a reusable view where you can set the text and so forth. If you only need a few of these for custom buttons or something, it might be easier to just draw them in your favorite drawing program.

Another possibility is to use a third party control, such as any of:

  • TITokenField

  • JSTokenField

  • COTokenField (part of COPeoplePickerViewController)

like image 118
Caleb Avatar answered Sep 28 '22 18:09

Caleb