Re: Drawing A Mutable String
Re: Drawing A Mutable String
- Subject: Re: Drawing A Mutable String
- From: Fritz Anderson <email@hidden>
- Date: Thu, 7 Jan 2010 15:18:40 -0600
On 7 Jan 2010, at 2:29 PM, Michael Craig wrote:
> if ([theDeck.cardPile count] == 0) {
> [infoStr appendString: @"\n\nThe deck is empty."]; //
> *2*
> }
> if (gameCon.invalidStack) {
> [infoStr appendString: @"\n\nThat's an invalid stack."]; //
> *1*
> }
> [infoStr drawInRect: infoRect
> withAttributes: infoAtts];
...
> If I move the line marked *1* to come after the line marked *2*, then both
> messages are drawn when the deck is empty, as one would expect.
>
> If I move the line marked *1* one line down (so it's outside of the
> invalidStack if statement and the if is empty), then invalidStack message is
> drawn at all times, as one would expect.
>
> So what is keeping it from drawing the appended text when it happens inside
> the invalidStack if statement? Like I said above, the if statement itself
> works fine.
I don't understand why you say "the if statement works fine." You say it doesn't execute its body when you think its condition is true. That means it doesn't work fine, doesn't it?
When you execute this code line-by-line in the debugger, do you see with your own eyes:
• gameCon (assuming it is an object pointer) is not nil?
• gameCon.invalidStack is non-zero?
• Control ever reaches line 1?
• infoStr changes content?
— F
_______________________________________________
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