oberbaum
oberbaum

Reputation: 2448

iphone/cocoa custom ui element

I'm very interested in using the typical mac 'tag' element in an iphone app (see specimen 1 - The Blue round element'). I dont really have any idea of how to implement it except for copying the color and making it a uibutton. I would like to be able to drag this tag from one 'section' to another 'section'.

Can someone point me in the right direction of how this would be done. Surely a simple library is available somewhere.

Keep it classy stackoverflow.

alt text http://posterous.com/getfile/files.posterous.com/norskben/mJPxKIUvQHrC3ew3LZS3I2F5poDzq4VefVt5ENgjY3iVH0KFh1ceswpm8RVq/account.png

Upvotes: 1

Views: 577

Answers (2)

bstahlhood
bstahlhood

Reputation: 2006

This control is called an NSTokenField in Cocoa AppKit. You can find something similar to start with in the three20 project. The control is called a TTPickerTextField I believe. You could use that as a basis for your control and add the drag and drop capabilities using the UIResponder methods touchesBegan/Moved/Ended.

Upvotes: 3

Alex Wayne
Alex Wayne

Reputation: 187262

Simply create a new class that is a subclass of UIView and add the subviews in the initWithFrame: method. Then implement the touch handling methods that you need to create your custom view with dragging behavior.

Upvotes: 1

Related Questions