Blogs

Profile 2.0.1 released

Profile is a medical practice management app that connects to Intrahealth's server. A small update is now available in the App Store, with some improvements:

Forms

  • Added support for background and text color properties of form templates: if set, the colors are used for the field prompt.
  • If a hint is set, it is displayed below the prompt.
  • Templates that have been deleted from the server are now marked as historical, so they aren't offered when adding a form in New Encounter.
  • Fixed layout of value picker popovers where they could appear off the bottom of the screen for long forms.
  • Date and time values now default to blank instead of today; tapping to display the picker will enter today's date/time.
  • Date and time pickers now include a Clear button to remove the value.
  • Fixed live-updating of date and time values.

Other

  • Changed the Unlock Profile view to combine the Server and Port fields into a single Server field. The http:// or https:// prefix is optional (it uses https:// if no port or a port of 443 is specified). Also, if the server is hosted on myaccession.com, just a server name can be entered, e.g. just the "example" part of "example.myaccession.com/aps".
  • Fixed an issue with SSL/TLS connections.
  • Improved text colour handling.
  • Settings for Appointments and Tasks now have wider date ranges, including an All option.
  • After saving a new case, automatically reloads the patient's interventions and problems, in case the server added some for the new case.
  • Some other performance and stability improvements.
  • Tweaked the icon, to make it more distinctive from version 1.

Remember, Profile requires an Intrahealth Profile server; you won't be able to do anything if you're not an Intrahealth customer.

If you're curious, you can learn more about Profile and see screenshots on the Profile product page on this site, and on the App Store.

BlogAssist 2.4b2 release

Here's another beta release of BlogAssist 2.4, my handy tool to help with HTML markup.

This beta includes some improvements to the really useful new substitutions feature, and updated localizations:

  • Made the substitutions feature smarter, so it doesn't replace text that already has substitutions applied.
  • Added four new default substitutions (off by default), showing how this feature can be used to replace URLs, e.g. to strip off a base URL for your own domain, or change it to localhost (or anything else).
  • Updated German and French localizations.
  • Updated the User Guide.

Download BlogAssist 2.4b2 now!

Time Out 1.7 released

Time Out 1.7 adds a couple of nice enhancements to the Sound break preferences, to change the volume and loop the start sound.

But the main reason for this update is to enhance Mountain Lion (OS X 10.8) support: to sign the app with an Apple-issued Developer ID for Gatekeeper support, move to the modern runtime, and related changes.

As with the recent BlogAssist release, Time Out 1.7 now requires Lion (OS X 10.7) or later and a 64-bit Intel machine. However Time Out is not sandboxed yet (and thus I can't update the Mac App Store edition); that will come in version 2.

Speaking of which, for those wondering about that great vaporware known as Time Out 2, it's still in the works — and the changes in this release are a great step towards that. I don't want to guess at when it'll be available, since various other projects keep getting in the way. It'll be ready when it's ready, but it's moving forward as time allows.

Here are the full release notes for version 1.7:

  • Added a Volume slider to the Sound break preferences, enabling sounds to be played quieter if desired.
  • Added a checkbox to enable repeating the start sound until the end of the break; useful to loop short sounds as an audio cue of the break.
  • Reimplemented the auto-launch preference to work with Mountain Lion and sandboxing.
  • Removed the quit confirmation preference.
  • Removed the in-app purchase options, since not compatible with 64-bit, and rarely used. (Standard edition only)
  • Fixed display of license entry date in the Licenses editor. (Standard edition only)
  • Fixed drafting an email if a license couldn't be found. (Standard edition only)
  • The standard edition of the app is now signed with a Developer ID to support Gatekeeper on Mountain Lion. (Standard edition only)
  • Time Out now requires a 64-bit Mac and a minimum of OS X 10.7 (Lion).
  • Many other behind-the-scenes improvements made possible by dropping older OS versions, PowerPC and 32-bit support.

Download Time Out 1.7 now!

Profile 2.0 released

I introduced Profile for iOS, the medical practice management app, about four months ago. Since then, I've been working on a major upgrade: version 2.0. This update includes many significant improvements:

  • Case Orientation.
  • Redesigned Appointments, Tasks & New Encounters.
  • Library content.
  • Forms.
  • Reference Series.
  • Lexicon.
  • On the Go Preferences.
  • And much more.

Read the release notes for full details.

Remember, Profile requires an Intrahealth Profile server; you won't be able to do anything if you're not an Intrahealth customer.

If you're curious, you can learn more about Profile and see screenshots on the Profile product page on this site, and on the App Store.

Time Out 1.7b2 released

Time Out 1.7 adds a couple of nice enhancements to the Sound break preferences, to change the volume and loop the start sound.

But the main reason for this update is to enhance Mountain Lion (OS X 10.8) support: to sign the app with an Apple-issued Developer ID for Gatekeeper support, move to the modern runtime, and related changes.

As with the recent BlogAssist release, Time Out 1.7 now requires Lion (OS X 10.7) or later and a 64-bit Intel machine. However Time Out is not sandboxed yet (and thus I can't update the Mac App Store edition); that will come in version 2.

Speaking of which, for those wondering about that great vaporware known as Time Out 2, it's still in the works — and the changes in this release are a great step towards that. I don't want to guess at when it'll be available, since various other projects keep getting in the way. It'll be ready when it's ready, but it's moving forward as time allows.

Here are the full release notes for version 1.7b1:

  • Added a Volume slider to the Sound break preferences, enabling sounds to be played quieter if desired.
  • Added a checkbox to enable repeating the start sound until the end of the break; useful to loop short sounds as an audio cue of the break.
  • Reimplemented the auto-launch preference to work with Mountain Lion and sandboxing.
  • Removed the quit confirmation preference.
  • Removed the in-app purchase options, since not compatible with 64-bit, and rarely used. (Standard edition only)
  • Fixed display of license entry date in the Licenses editor. (Standard edition only)
  • Fixed drafting an email if a license couldn't be found. (Standard edition only)
  • The standard edition of the app is now signed with a Developer ID to support Gatekeeper on Mountain Lion. (Standard edition only)
  • Time Out now requires a 64-bit Mac and a minimum of OS X 10.7 (Lion).
  • Many other behind-the-scenes improvements made possible by dropping older OS versions, PowerPC and 32-bit support.

UPDATE: I've just released 1.7b2, which fixes a bug with resetting the timers in the first beta. Sorry about that!

Download Time Out 1.7b2 now!

BlogAssist 2.4b1 release

Time to dip my toe in the sandbox!

I'm pleased to report that I have been able to drag BlogAssist, my handy tool to help with HTML markup, into 2012: it is now fully sandboxed, providing increased security, and signed with an Apple-issued "Developer ID" so it plays nicely with Mountain Lion.

I also raised the minimum OS version from Leopard (10.5) to Lion (10.7). I know some people are still on Snow Leopard (and a tiny percentage still on Leopard), but I felt it was worthwhile moving to Lion, as the majority of customers are on this OS (and soon will be moving up to Mountain Lion), and it enables me to leverage lots of great OS features moving forward.

It is now a 64-bit app... which isn't really necessary from a data perspective (BlogAssist doesn't use lots of data), but means it uses the "modern runtime", which offers some great benefits on the backend.

This release also includes handy new substitution preferences, which non-English customers will particularly enjoy (it's something my French localizer originally asked for). Easily convert symbols and accented characters into their HTML entities.

This is a beta release, with lots of big infrastructural changes, so please let me know if you find any issues. It all seems fine in my testing, though. BlogAssist is a simple app, which is why I moved it to Lion, 64-bit, sandboxing and Developer ID first.

Here are the full release notes:

  • Added a Substitutions preference page, that optionally replaces symbols and accented characters with the HTML entity equivalents.
  • Updated all three BlogAssist modes to support the new substitution preferences.
  • Reimplemented the auto-launch preference to work with Mountain Lion and sandboxing.
  • Removed the quit confirmation preference.
  • Added a license button to the Preferences window, when unlicensed, to make it easier to buy the app. (Standard edition only)
  • Removed the in-app purchase options, since not compatibile with 64-bit, and rarely used. (Standard edition only)
  • Fixed display of license entry date in the Licenses editor. (Standard edition only)
  • The standard edition of the app is now signed with a Developer ID to support Gatekeeper on Mountain Lion. (Standard edition only)
  • The app is now fully sandboxed, providing increased security.
  • BlogAssist now requires a 64-bit Mac and a minimum of OS X 10.7 (Lion).
  • Many other behind-the-scenes improvements made possible by dropping older OS versions, PowerPC and 32-bit support.

Download BlogAssist 2.4b1 now!

Tweeps 3.0.1 released

I'm pleased to announce a major upgrade of my iOS app to help manage Twitter accounts, Tweeps. Version 3 has been rewritten to use iOS 5's built-in Twitter accounts, so you no longer need to authenticate them in Tweeps.

It also adds a feature that version 1 had, but I had to remove in version 2 — the ability to edit avatar images. You can take a photo with the camera, choose a picture from your photo library, or paste an image from a web page or other app, and set it as the avatar for your Twitter account.

I also replaced the brown color scheme with the standard iOS theme. I didn't really like the brown. The idea was to match the nest theme of the icon, but brown isn't the most attractive color.

Tweeps 3 also supports retina graphics on the new iPad, the sidebar is always visible for easier access, and other improvements.

Tweeps 3 requires iOS 5 or later, and is universal, so works natively on iPad, iPhone, and iPod touch.

I'll leave Tweeps free for today, but tomorrow will increase the price. I'm thinking of an experiment: set the price at $9.99 tomorrow, then decrease it by a dollar each week, to a final price of $0.99. A bit of the reverse of a more traditional technique of starting cheap and increasing the price over time. We'll see how it goes.

Update: Thanks to everyone who downloaded it while free; please leave a review. And thanks to everyone who buys it now; your purchases help fund the development work!

Learn more about Tweeps:

CNET: how to reduce computer-related eyestrain

Thanks to Sharon Vaknin for the mention of Time Out in this video, that gives helpful tips on reducing eyestrain:

Watch on YouTube.

WWDC: a modest proposal

WWDC 2012 tickets went on sale this morning... and sold out less than two hours later. Last year it took 12 hours, two years ago it was a week, before that a month, or more.

So next year it will sell out in what, half an hour? This isn't very sustainable.

I think in this digital age the WWDC format isn't really suitable anymore. I hope that Apple is considering other approaches.

Presentation sessions aren't a very effective way to disseminate information. Live demos and Keynote slideshows are interesting and useful, but when most people watch them on the videos later, I think everyone would be better served if Apple posted presentation videos before the conference — like a month or so before, so people have time to watch them and can discuss them at the conference.

That'd be easier for Apple's developers, too — no pressure to get it right on the day, and would enable them to edit and perfect the videos.

Perhaps the main benefits of attending WWDC are the social interaction amongst developers, and the opportunity to meet and discuss issues with Apple developers at labs and elsewhere.

So if WWDC moved the sessions to videos, the conference could be all about such interactions. It could retain fun events like the Bash, the Apple Design Awards, and Stump the Experts, and perhaps add other similar group activities. Plus the Apple developers could be available throughout the week for one-on-one labs and casual meetings.

To address the limited availability, WWDC could move to a model like other conferences and conventions: sell tickets for individual days. For the very keen, there could be multi-day passes, but for many developers, one or two days would be plenty. Plus without sessions taking up all the room, many more people could attend group events like the awards etc, or find a space for smaller meetups.

Different days could focus on different areas, too — perhaps Monday for the keynote and awards shows, Tuesday & Wednesday for iOS, and Thursday & Friday for Mac. Though without the sessions, the few remaining events and labs could be spread out so more people have a chance to attend the areas that interest them.

I think this would be much better all round, and would enable WWDC to better serve and cope with the ever expanding developer community.

Time Out 1.6.5 released

Here's a quick update of Time Out 1.6.5, to fix the incorrect display of when the next normal break is due.

This was caused by what I think is a bug in Lion — the way a date id described (to convert from a date to a string) no longer matches the documented format, and so it fails to be converted back from a string to a date.

Anyway, all better now. Sorry for any inconvenience!

I'm currently spending weekdays working on Profile version 2, and weekends on Time Out version 2. I got the agent communication working this weekend (the stuff that will let Time Out run in the background without having to be in the Dock). Next weekend I'll be working on the main configuration window. Hopefully I'll have the first alpha release available in a few weeks time (only for a small team of testers, yet to be selected from a list of volunteers).

Download Time Out 1.6.5 now!

Introducing Profile for iOS

I'm pleased to introduce a new app for iOS: Profile.

Profile is an iOS app for iPad, iPhone and iPod touch to provide on-the-go access to the powerful medical practice management system provided by Intrahealth — a leading medical software vendor in New Zealand, Canada and Australia.

Important: please note that Profile can only be used by licensed users of Intrahealth's software; it requires logging into their server software. So there's no point in downloading it unless you are already an Intrahealth customer.

I think this is the first mention of Intrahealth on the Dejal site... but I've actually been working with Intrahealth for about 17 years now. I started contracting work with them back in 1995, working on their Macintosh Medical Administration System (MMAS) product, which later became Profile for Mac. I still help out with that a bit, but nowadays spend most of my Intrahealth (IH) time working on Profile for iOS.

This project started in January 2011, though work in earnest didn't start till August 2011. Version 1.0 was released late last month, and version 1.1 was released today. I'm already hard at work on version 2.

So, if you've wondered at the slow progress on Time Out 2 and other apps, now you know why. But don't worry, I have time allocated for Time Out 2, and have been making good progress on it.

If you're curious, you can learn more about Profile and see screenshots on the Profile product page on this site, and on the App Store.

Simon 3.4 released

Shortest beta ever!

I must admit, I set the version number in 3.4b3 to just 3.4, for the Mac App Store release, and forgot to set it back. So the version I released this morning as 3.4b3 was actually a general release build. Since the previous version had been in beta several weeks, and there was just one change in this new build, I decided to let it remain as such.

So, here it is, officially as a general release!

This version includes a much more reliable Automatic Email transport, along with some other improvements:

  • New tests now use the Change filter by default, to avoid confusion over new tests not detecting changes. (You can of course alter that to a more specific filter, or disable it.)
  • Replaced the Email notifier's Automatic transport with a new one, now called Apple Mail, that sends the message via Apple's Mail app. (Standard edition only)
  • The From field is now replaced by a pop-up menu of mail accounts for the new Apple Mail transport. (Standard edition only)
  • The Reply-To and X-Header fields are now disabled in the Apple Mail transport, since those are not supported by the new mechanism. (Standard edition only)
  • Added a hidden preference to switch back to the old Automatic transport, just in case (it will be removed in a future version). It can be enabled via defaults write com.dejal.simon EmailUseLegacyTransport YES in Terminal. (Standard edition only)
  • Also updated the SMS notifer plug-in to send email via Apple Mail, and use a pop-up menu for the From address. (Standard edition only)
  • The license button in the Simon Monitor window now shows the Licenses window instead of going to the Dejal Store web page. (Standard edition only)
  • Fixed issue where an offline test wouldn't check again until checked manually.
  • Fixed an issue that prevented the second check of a new test from detecting a change. (Note that new or edited tests don't register a change for the first check after editing, in case the configuration was altered.)
  • Fixed an incompatibility with Mac OS X 10.7.3.

Download Simon 3.4 now!

Simon 3.4b3 released

A quick update of Simon, to 3.4b3.

This release fixes an issue that prevented the second check of a new test from detecting a change. Subsequent checks worked fine, but the second check not detecting a change can cause confusion.

Note that new or edited tests don't register a change for the first check after editing, in case the configuration was altered.

This will probably be the last beta before the general release. So please let me know if you find any issues.

Download Simon 3.4b3 now!

Time Out 1.6.4 released

A quick update of Time Out, my free break tool, to version 1.6.4.

  • Improved compatibility with Mac OS X 10.7.3.
  • The donation button in the Preferences window now shows the Licenses window instead of going to the Dejal Store web page. (Standard edition only)

Version 2 is still in the works — it has had some delays due to client work and other projects, but I've been working on prototypes and prerequisite projects to keep Time Out 2 moving forward.

And as always, if you donate now, you'll get a Time Out 2 license, that you can add to the current releases. Set your own price! (This offer expires when version 2 is released.)

Download Time Out 1.6.4 now!

Simon 3.4b2 released

Simon 3.4b2 is all about the Email and SMS notifier plug-ins.

Ever since the Email notifier was introduced, several years ago, it has been problematic — configuring email settings can be quite difficult.

This release replaces the Automatic email mode with a new Apple Mail one, which (as the name implies) uses Apple's Mail app to send the email. It has a convenient list of accounts, just like in Mail (if you have that option enabled there), and when it notifies it launches Mail in the background (if it is not already running) and quietly sends the email.

So this makes configuring the Email notifier easier, and it should be much more reliable than the old "Automatic" mechanism. As a bonus, you'll have a record of the sent emails in your Sent mailbox in Mail (you can always use a rule to delete them if you wish).

If you don't want to use Mail, or want more control, you can still use the custom SMTP and sendmail transports.

Finally, the SMS notifier plug-in also uses the new Apple Mail mechanism, as an alternative to the Clickatell service.

Here are the release notes with more information:

  • Replaced the Email notifier's Automatic transport with a new one, now called Apple Mail, that sends the message via Apple's Mail app. (Standard edition only)
  • The From field is now replaced by a pop-up menu of mail accounts for the new Apple Mail transport. (Standard edition only)
  • The Reply-To and X-Header fields are now disabled in the Apple Mail transport, since those are not supported by the new mechanism. (Standard edition only)
  • Added a hidden preference to switch back to the old Automatic transport, just in case (it will be removed in a future version). It can be enabled via defaults write com.dejal.simon EmailUseLegacyTransport YES in Terminal. (Standard edition only)
  • Also updated the SMS notifer plug-in to send email via Apple Mail, and use a pop-up menu for the From address. (Standard edition only)

Download Simon 3.4b2 now!

BlogAssist 2.3 release

Here is a new release of BlogAssist, my handy HTML markup tool.

Note also that BlogAssist is included in the new TheMacBundles promotion (not live as I write this, but probably will be by the time you read this).

Version 2.3 includes:

  • Improved compatibility with Mac OS X 10.7.3.
  • Changed the +/- buttons in the Operations preferences to a modern square style.
  • Removed the license agreement window. The license agreement can be viewed online.
  • BlogAssist now requires a minimum of Mac OS X 10.5 (Leopard).
  • Many other behind-the-scenes improvements made possible by dropping Tiger support.
  • Note: this version (and any 2.3.x bug fix releases) will be the last to support PowerPC (PPC) and Mac OS X 10.5. Subsequent releases will require an Intel-based Mac and Mac OS X 10.7 (Lion) or later.

Download BlogAssist 2.3 now!

Simon 3.4b1 released

I've just done a small beta release of Simon, to version 3.4b1.

This has a useful change, and a couple of important fixes:

  • New tests now use the Change filter by default, to avoid confusion over new tests not detecting changes. (You can of course alter that to a more specific filter, or disable it.)
  • Fixed issue where an offline test wouldn't check again until checked manually.
  • Fixed an incompatibility with Mac OS X 10.7.3.

I am spending most of my time on a couple of new projects (one of them for a client, the other as a prototype for Time Out 2 technology). But I plan to do small incremental beta releases of Simon 3.4 over the next few weeks, basically releasing changes as soon as I've done them, since work on it will be sporadic. It'll be an interesting experiment in release styles.

As always, if you find any issues or have any suggestions for improvements, let me know in the Simon Forum. While I'm working on a release is a great time to send in suggestions, as they're much more likely to get implemented straight away, instead of added to the feature suggestions list. (But no promises; as I said, my time on Simon is limited currently.)

Download Simon 3.4b1 now!

Dejal Open Source

Like anything else, source code can get a bit untidy and crusty after a while. My Cocoa code is about a decade old now, so it's been well overdue for a cleanup. I have just completed a process of reorganizing all of the source code for future Lion and iOS 5 editions of Dejal projects.

One of the changes was to rename the open source and shared code to use a "Dejal" prefix rather than "DS" as before. Although I could have left the old prefix, the new one fits better with Apple's naming guidelines: they reserve all two-letter prefixes for themselves.

I also rearranged the code. I used to have separate Subversion repositories for iOS and Mac projects. Now I have code for iOS, Mac and cross-platform mixed in a repository, since there is a lot of code that works on both platforms.

Another big change was to move the open source projects from Subversion to Git. I've long resisted Git, but it really seems the most popular version control system for open source projects. And GitHub is a very nice way to share Git projects, with handy online viewing of documentation and source code, plus useful additions like issue tracking.

So now my open source projects are hosted on GitHub. You can view my GitHub page. Initially I have two iOS projects there: the small DejalView (formerly DSView) project, plus the very popular DejalActivityView (formerly DSActivityView) project. I will add more over time.

These projects have been updated for iOS 5 and ARC, plus general code improvements. They also have new README and license files. They use a standard BSD license.

I also took this opportunity to redesign the Dejal Developer page. The design was inspired by Matt Gemmell's excellent open source page (I got his permission to copy his design, but it ended up somewhat different).

Take a look at the new pages:

  • Dejal Open Source: the main Developer page, with general information at the top, followed by information on each project (with more to come).
  • Dejal Open Source License: a summary of my intention with the license for the source code, suggested attribution format, and the legal text.
  • Developer Store: enables you to donate in appreciation for the open source, or buy non-attribution licenses.

This last is interesting — the open source is available completely free, provided that you give Dejal credit in your app's About view, documentation, or website. If the code helps you, it's often nice to give something back, so now you can express appreciation via a donation or (just for fun, also inspired by Matt) a gift from my Amazon.com Wish List. But if you can't or don't want to give credit, you can purchase licenses that allow you to use the code without having to give credit. Hopefully that'll cover everyone's needs, but if you have some other requirement, let me know.

I hope you find my open source code useful. Keep an eye out for future additions; I have a Mac project coming soon (a feature that will appear in Time Out 2).

You can follow @dejalopen on Twitter to get notifications of updates, or follow @dejal for general Dejal news. You can also subscribe to the RSS feed of the Dejal Blog filtered for Open Source topics.

DejalActivityView: open source iOS project to display an activity indicator with adjustable text

Note: this is an updated post based on an older one, due to renaming the project (was "DSActivityView") and moving it from Subversion to GitHub.

DejalActivityViewI wrote a reusable class for a couple of iOS apps I was working on, called DejalActivityView. I decided to release it as open source. It has proven quite popular with others, too. Read on for details (including a demo movie).

Firstly, I should say that this work was inspired in part by Matt Gallagher's excellent article, Showing a "Loading..." message over the iPhone keyboard. My code only uses the -keyboardView method from his article, but he deserves credit and thanks for that and many other helpful articles. If you're not reading his blog, Cocoa with Love, you're doing yourself a disservice.

Back to my class. Actually, there are four classes: DejalActivityView, DejalWhiteActivityView, DejalBezelActivityView, and DejalKeyboardActivityView. They provide four styles of activity view, and could easily be extended to support more.

DejalActivityView

DejalActivityViewThis does a simple horizontal-style loading view, intended for situations where you have a blank view while loading data. It can be displayed very easily — for the default "Loading..." label text, simply use:

[DejalActivityView activityViewForView:self.view];

The activity view is automatically added as a subview of the specified view (e.g. the current content view). No need to save the result to an ivar. It automatically supports rotation to any orientation, too.

You can specify a custom label via:

[DejalActivityView activityViewForView:self.view withLabel:@"Processing..."];

Or specify a custom width, e.g. so you can change the label while it is being displayed without upsetting the geometry, via:

[DejalActivityView activityViewForView:self.view withLabel:@"Connecting..." width:100];

You can also have it manage the network activity indicator in the status bar, via a showNetworkActivityIndicator boolean property. It is NO by default, but if set to YES the network activity indicator in the status bar will be displayed, and automatically hidden when the DejalActivityView is removed. For example:

[DejalActivityView activityViewForView:self.view].showNetworkActivityIndicator = YES;

You can also toggle it on an already-visible activity view:

[DejalActivityView currentActivityView].showNetworkActivityIndicator = YES;

When you're done with the activity view, simply invoke this to get rid of it:

[DejalActivityView removeView];

DejalWhiteActivityView

This is the same as DejalActivityView, but with a white indicator and text instead of black, for use in dark views.

DejalBezelActivityView

DejalBezelActivityViewThis is a subclass of DejalActivityView, which displays an animated round-rect-enclosed variation: it animates into view by zooming from full-screen, with a gray background fading in to cover the passed view, and animates out by zooming to half size and fading out the background (see below for a movie showing it in action). It is ideal for situations where you have content visible already, but want to do a network operation to validate or send data, or some other time-consuming activity.

Display it the same way as DejalActivityView:

[DejalBezelActivityView activityViewForView:self.view];

The [DejalBezelActivityView activityViewForView:withLabel:] and [DejalBezelActivityView activityViewForView:withLabel:width:] variations are also available.

You can also split the label over multiple lines, thanks to a change contributed by Suleman Sidat. Thank you! Simply include one or more \n sequences in the label text, e.g.

[DejalBezelActivityView activityViewForView:self.view withLabel:@"Split over\nMultiple lines..."]

Similarly, to display an activity view with just the activity indicator, and no label, simply specify a blank label:

[DejalBezelActivityView activityViewForView:self.view withLabel:@""]

To remove with animation, call:

[DejalBezelActivityView removeViewAnimated:YES];

DejalKeyboardActivityView

DejalKeyboardActivityViewThis is a subclass of DejalBezelActivityView, which displays over the keyboard, somewhat like the iOS 2 Text app used to do. It is useful to simply prevent further typing while validating a field or sending data (though you might also want to disable the field, to prevent pasteboard operations on it). No need to specify a view to use for this, since it uses the keyboard. (This class may be removed in the future, since it isn't that useful nowadays; let me know if you need it.)

[DejalKeyboardActivityView activityView];

Plus a [DejalKeyboardActivityView activityViewWithLabel:] variation for custom text. Remove it the same as for the bezel style:

[DejalKeyboardActivityView removeViewAnimated:YES];

Demo

I've included a demo project that builds an app to show the various options: the four styles, default or custom label text, covering just the content view or whole window, etc. It requires iOS 5. Here's a movie of an earlier version of the demo, showing the demo app running (this project used to be called "DSActivityView"):

You can get the code and more information from the Dejal Open Source page.

DejalView: open source project for iOS to detect a tap outside a button

Note: this is an updated post based on an older one, due to renaming the project (was "DSView") and moving it from Subversion to GitHub.

In Tweeps I have a button that I wanted to behave like the Delete button in a table view. You know, when you tap the delete toggle to the left of a cell, a red Delete button appears. And tapping anywhere other than that button will hide it without doing anything else:

Table Delete button
(Contacts app)

I couldn't see any obvious way to do it, so asked on the iPhone Developer forums, and got a helpful reply suggesting a UIWindow subclass, overriding -sendEvent:.

I tried implementing that, but what I really wanted was to override -hitTest:withEvent:, since I wanted to block taps on views other than a specific button, and the documentation says one should always invoke the superclass of -sendEvent:.

Then I noticed that -hitTest:withEvent: is actually defined in UIView, and further experimenting with the table Delete feature showed that it appears to be implemented UITableView, since the cancel tap behavior only occurs in the table, not the navigation bar or toolbar. Besides, implementing in a UIView subclass is more focal, so a better choice.

So here is my UIView subclass to do this. It uses a delegate approach, with a protocol to declare the method:

@class DejalView;

@protocol DejalViewDelegate <NSObject>
@optional

- (UIView *)view:(DejalView *)view hitTest:(CGPoint)point withEvent:(UIEvent *)event hitView:(UIView *)hitView;

@end

And the actual subclass interface:

@interface DejalView : UIView

@property (nonatomic, weak) id <DejalViewDelegate> viewDelegate;

@end

With the implementation just overriding the hit test method. It simply invokes the superclass then gives the delegate a chance to change it (or perform some other action) if it implements the delegate protocol method:

#import "DejalView.h"


@implementation DejalView

@synthesize viewDelegate = dejalViewDelegate;

/*
  hitTest:withEvent:
 
  Overrides this method to add support for the -view:hitTest:withEvent:hitView view delegate behavior.
 
  Written by DJS 2009-09.
*/

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
{
    UIView *hitView = [super hitTest:point withEvent:event];
   
    if ([self.viewDelegate respondsToSelector:@selector(view:hitTest:withEvent:hitView:)])
        return [self.viewDelegate view:self hitTest:point withEvent:event
            hitView:hitView];
    else
        return hitView;
}

@end

To use this, simply change a container UIView to DejalView in the view hierarchy, then set the delegate property to your view controller (via code or IB):

self.view.viewDelegate = self;

Then implement the -view:hitTest:withEvent:hitView: delegate method in your view controller, e.g. as follows — this will cause a tap on some special control (or if that control is hidden) to go through as normal, but tapping anywhere else in the view will hide the special control, without passing the tap on to whatever was actually tapped:

- (UIView *)view:(DSView *)view hitTest:(CGPoint)point
        withEvent:(UIEvent *)event hitView:(UIView *)hitView;
{
    if (someSpecialControl.hidden || hitView == someSpecialControl)
        return hitView;
   
    someSpecialControl.hidden = YES;
   
    return nil;
}

I hope this is useful to someone else too.

You can get the code and more information from the Dejal Open Source page.

Syndicate content