• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: something I can't understand
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: something I can't understand


  • Subject: Re: something I can't understand
  • From: Agha Khan <email@hidden>
  • Date: Wed, 29 Jul 2009 14:18:27 -0700

Dear bbum:
Well After your email I started to write a small app to send you the project for passing my point across.


AND FOUND THE PROBLEM.
@interface PngButton : UIButton
{
@public
	CGPoint horizontalLoc;
	CGPoint verticalLoc;
}
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end

rotateRightBtn	= [PngButton buttonWithType:UIButtonTypeInfoDark];

In 99.99% cases it is correct statement. But it is not correct for my application, because it will create UIButton button but not embedded other objects as I am holding other CGPoint objects.

NO wonder it was failing. :-)

Now my question how to create such object and set flags as buttonWithType:UIButtonTypeInfoDark?

Any Idea?

Your email is very much appreciated.
Thanks for putting me in right direction.

Best regards
Agha




On Jul 29, 2009, at 12:50 PM, Bill Bumgarner wrote:

On Jul 29, 2009, at 12:20 PM, Agha Khan wrote:
Well after spending whole 2 days on a such a small problem I understand this is a bug and Apple has to fix it. The bug is If you inherit for UIButton then it is not going to work.

Given that this code is really really basic stuff, do you really think that there would be a bug along this code path?


Pretty darned unlikely. Assuming you are using @synthesize to synthesize the setter/getter for that property, there are many hundreds of other code paths that do exactly that and those paths are executed billions of times per day across all the iPhones in the world. That is an awful lot of evidence that @synthesize & properties is working just fine.

So, no, this isn't a bug that Apple has to fix. It is a bug that you have to fix. Or a bug that you have to demonstrate isn't your bug, which you haven't done yet.


It worked fine on
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 : 410,50); // No problem.


but it did not work
CGPoint pt = pPngButton.verticalLoc; // GOt __TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__
so I removed that line.


and tried
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 : 410,50); // No problem.
pPngButton.verticalLoc = pt; // Again GOt __TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__

What is the one common case for both of the lines of code that crash?

pPngButton.verticalLoc

Are you absolutely positively sure that pPngButton is actually a valid object at the point above where the crash happens?


I'd bet you a pitcher of beer it isn't or that you have implemented - verticalLoc and -setVerticalLoc: incorrectly (if not using @synthesize). I'd wager that you have not properly retained or may have over-released the object sometime prior.

Try inserting [pPngButton self] above either of the crashing lines. More likely than not, *that* will crash.

Some time ago, you wrote:

PngButton* pPngButton = [PngButton buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0, 36, 36)]; // No problem


pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES) ? 250 : 410, 50.0);

Is this the entirety of your code that refers to pPngButton? Is it really all contiguous like that? Or does that latter line of code appear in a different method? Where are you retaining pPngButton? ...do you stick it in view hierarchy somewhere?


b.bum


_______________________________________________

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


  • Follow-Ups:
    • Re: something I can't understand
      • From: Bill Bumgarner <email@hidden>
References: 
 >something I can't understand (From: Agha Khan <email@hidden>)
 >Re: something I can't understand (From: Kiel Gillard <email@hidden>)
 >Re: something I can't understand (From: Agha Khan <email@hidden>)
 >Re: something I can't understand (From: Dragos Ionel <email@hidden>)
 >Re: something I can't understand (From: Agha Khan <email@hidden>)
 >Re: something I can't understand (From: Dragos Ionel <email@hidden>)
 >Re: something I can't understand (From: Agha Khan <email@hidden>)
 >Re: something I can't understand (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Little "mind explanation" for changing views in iPhone
  • Next by Date: [SOLVED] NSArrayController subclass computed property not being updated
  • Previous by thread: Re: something I can't understand
  • Next by thread: Re: something I can't understand
  • Index(es):
    • Date
    • Thread