开发者

Custom UIActivityIndicator, that is part of customized Framework or as a Sub Class

开发者 https://www.devze.com 2023-02-06 23:04 出处:网络
Looking for some help on the best way 开发者_JAVA技巧to create a custom UIActivityIndicator.I think that ideally, it should be a SubClass of UIActivityIndicator so that we can easily distribute it to

Looking for some help on the best way 开发者_JAVA技巧to create a custom UIActivityIndicator. I think that ideally, it should be a SubClass of UIActivityIndicator so that we can easily distribute it to other apps that might want to take advantage of it, and easily drag and drop where it should go in Interface Builder.

As an example, the UIActivityIndicator on the TMZ app seems to be custom, but being new to Objective-C and over Xcode development, and I'm struggling with a place to start and the best most efficient approach. Has this proverbial "wheel" already been created?

Thanks in advance for your time.


UIActivityIndicator is not designed to be customized, so subclassing it won't do you much good. But it is a simple UI element which can be written from scratch in an hour. Since you don't want it to respond to events, make it a subclass of UIView and set userInteractionEnabled to NO. The downside is that IB won't show a nice preview as with UIActivityIndicator.

Reusing such a class is easy: just add the interface/implementation files to an Xcode project and #import the header.

UIActivityIndicator works like an animated GIF, displaying a series of images. Of course, you can do the same or you can just animate transform property of a sublayer to make it spin.

0

精彩评论

暂无评论...
验证码 换一张
取 消