Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Custom Control Creation

DZone's Guide to

Custom Control Creation

· Mobile Zone
Free Resource

Get gorgeous, multi-touch charts for your iOS application with just a few lines of code.

This is a stellar walkthrough of, well, as it says,

How to build a custom control in iOS

For example, what if you want to build a control to help the user select an Angle value between 0 and 360?

A solution would be to create a circular slider and let the user drag the knob to select the angle value. This is something you’ve probably already seen in many other interfaces but nothing similar is available in UIKit.

That’s why this is the perfect example we can use to set aside UIKit and build something special. But first, here’s a sneak peek of what we are going to create…

slider_preview_phone.png

Some nifty little CoreGraphics and trigonometry tips to boot; worth reading even if you’re already familiar with control writing.

Another topic that goes nicely with writing a control is making it support UIAppearance skinning — so along with that, check out

UIAppearance for Custom Views

In the simplest case, add UI_APPEARANCE_SELECTOR to your properties to inform others that this property can be set via an UIAppearance proxy. There are however some gotchas that are not clearly mentioned in the documentation, and it’s always interesting how something like this works behind the scenes…

Good tips there it’d take you a fair bit of confusion to sort out on your own!

h/t: iOS Dev Weekly!

 

.Net developers: use Highcharts, the industry's leading interactive charting library, without writing a single line of JavaScript.

Topics:

Published at DZone with permission of Alex Curylo, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}