1

I have been developing iOS for couple of years. So for I have worked with only UI component Apple provided like UITableView, UIPicker, UISegmentController etc. Now I want get the ability to create any UI element or control my own and provide appropriate animation. What I need to learn to do that with Swift or Objective C? Please provide the with resource?

Rokon
  • 355
  • 3
  • 11

4 Answers4

1

Whenever you want to learn a new part of the system, you should check Apple's iOS Developer Library. This will give you all the information you need on any part of the system. In particular, check out View Programming Guide for iOS and Core Animation Programming Guide.

Jim
  • 72,985
  • 14
  • 101
  • 108
1

Creating custom controls is one thing and animating a view is another thing. As far as animation is concerned you can follow this tutorial to understand the underlying concepts.

However there are couple of very simple things you need to know to perform the animations.

  1. Use the animation api of the UIView class
  2. Use the properties like frame and transform of a view
Adeel Miraj
  • 2,472
  • 3
  • 22
  • 32
1

There are two levels at which you can do this:

  1. Core Animation Layers (deep and fun because FREEDOM!): this is the layer backing into which all UIViews and everything in UIKit is drawn into. In any UIView element you can create as many Core Animation Layers and objects as you like. Core Animation has its own drawing methodologies and uniquely low level control of those things. It is almost like a game engine without a game loop. You can draw custom shapes, animated them in all sorts of fanciful ways and do anything you can imagine.

  2. UIView Customisation (shallow but wide, constrained): You can draw anything into a UIView, and do anything with as many UIViews as you need to express any creative UI ideas. You're not as limited (creatively) as you might think, but you are limited in how you go about doing it, in that you must use UIViews as a construct into and onto which you do everything.

The sage advice of modern programming is that each is better for its own purposes and problems... blah blah blah...

The deeper truth is that learning Core Animation is actually fun, liberating and will reveal more to you about how Apple's frameworks work than anything else you can possibly study within the iOS world, of the iOS world.

There are two long winded ways to get there. Nick Lockwood's book on Core Animation, whilst old (relatively) is still accurate. Just skim read it so you get a great feel for what Core Animation is, and can do...

Then get at the deep dive books by Matt Neuberg, in which he discusses views and their mechanics in a detail that's unmatched, anywhere:

SKOOP
  • 364
  • 2
  • 14
  • Matt is also somewhere around on here, and grumpy as grumpy gets. But that's ok. He's earned the right to be grumpy. To a point. – SKOOP Jul 17 '16 at 08:59
1

You could start by creating a subclass of UIControl. Since UIControl is itself just a subclass of UIView you could treat is as you would treat UIView, but taking advantage of UIControl's special features, like the target-action mechanism and using beginTrackingWithTouch:withEvent: to track touches.

As for animation, Core Animation is it. iOS provides some really time-saving out-of-the-box features like animated properties, where pretty much the animation is done without any effort on your part. However, custom animations are not difficult to implement.

Good luck!

jp2g
  • 682
  • 4
  • 8