Problem With Setting Badge via Interface Builder
Problem With Setting Badge via Interface Builder
- Subject: Problem With Setting Badge via Interface Builder
- From: "Henry McGilton (Boulevardier)" <email@hidden>
- Date: Sun, 22 Nov 2009 20:57:07 -0800
I wonder if anybody else has seen this particular end case.
I googled for anything remotely like this problem and found nothing really
relevant, and CocoBuilder is down right now.
In a group learning situation last week, one of the people stumbled over a
problem defining and then trying to un-define a Tab Bar Item Badge using
Interface Builder. The scenario is this:
We started with a Window-based Application (having decided the Xcode Tab
Bar iPhone Application template is too confusing --- That's not necessarily
germane to the discussion to follow).
First thing is to drag a Tab Bar Controller object into MainWindow.xib.
You change the view of MainWindow.xib to List View, so you can fiddle
around making the various View Controllers have the correct class
identities and do other stuff . . .
One of the group was exploring, selected the Tab Bar Item, saw the Badge
property, thought, 'This could be useful', and set the Badge value to some
number (let's say 5) . . . The Tab Bar Item dutifully displayed a nice badge
with the number 5 inside.
Having seen that, he then selected the Badge text field and deleted the text.
But, the badge itself stays around, just does not display any content. In other
words, a blank badge.
Given that the default value of the Tab Bar Item's Badge property is nil, I
surmise that setting that property to *anything* via Interface Builder will
then create an NSString. At that point, even if one deletes the text in the
text field, the badge property is then/still displaying a zero-length NSString.
Using Interface Builder, the only solution appears to be to delete the Tab
Bar Item and re-create it, which, while likely taking only a minute or so to
set up everything and establish correct class identity and such , seems a
little akin to swatting mosquitoes with sledge-hammers . . .
The other approach is to grab the Tab Bar items in the App Delegate and
set all their badge properties to nil. Of course that means one needs to
be aware of which items actually *want to* be badged . . .
I'd like to know if anybody else has stumbled over this one.
Cheers,
. . . . . . . . Henry
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden