DSActivityView updated for iOS 4

This blog post has been replaced by a newer edition.

Please see blog posts on DejalActivityView.

DSActivityViewI've committed a minor update to the DSActivityView open source project for iOS. See the DSActivityView introductory post for more information, including a video demo.

This update adds a new prefix to the class methods to create the activity view, to make it more clear that they return a retained object, rather than autoreleased.

So you'd now display the activity view via something like this:


[DSActivityView newActivityViewForView:self.view]

This update also includes a bug fix for iOS 4, where the activity view would appear behind the keyboard.

It is compatible with iOS 3.0 and later, including iOS 4, on iPad, iPhone and iPod touch.

You can get the project from my Dejal Open Source Subversion repository via this Terminal command:


svn checkout http://dejal.svn.beanstalkapp.com/open/DSActivityView

Or browse the source directly on the web.

Re: DSActivityView updated for iOS 4

The DSBezelActivityIndicator looks really good!
Unfortunatly this line:
[DSBezelActivityView newActivityViewForView:self.view withLabel:NSLocalizedString(@"Loading", @"Activity indicator loading")];

generates this analyzer warning i can't get rid off:
Potential leak of an object allocated on line...

David Sinclair's picture

Re: DSActivityView updated for iOS 4

Interesting... that was the main reason for adding the "new" prefix to the class methods: to avoid analyzer warnings like that.

Not sure how else to avoid such warnings, without totally redesigning the class. If you think of a way, let me know.

Re: DSActivityView updated for iOS 4

I could get rid of the warning from analyzer by having a DSActivityView property that is declared as (nonatomic, assign) and use it this way:

- (void) showActivityView:(BOOL)activate {
if (activate) {
self.activityView = [DSBezelActivityView newActivityViewForView:self.view withLabel:NSLocalizedString(@"Loading", @"Activity indicator loading") width:0];
}
else {
[DSBezelActivityView removeViewAnimated:YES];
}
}

When removeViewAnimated is called, the dsactivityview is dealloced.

David Sinclair's picture

Re: DSActivityView updated for iOS 4

Yeah, that'd work... though I wrote DSActivityView in such a way as to avoid the need to assign it to a property, so that isn't ideal.