tags:

views:

52

answers:

2

Hello,

Im trying to call performClick: from awakeFromNib and its not working. I think its because it needs a sender and awakeFromNib has no sender. I have tried using nil,self and sender as the sender of performClick: but none seem to work. My code is

- (void)awakeFromNib {
[myButton performClick:sender];
}

Can anyone think of a work around for this? Thanks for any help

+1  A: 

You should always call [super awakeFromNib] because you never know what the super class is doing.

awakeFromNib is a bad place to put performClick: because although everything is loaded and initialized, there is no guarantee everything has been enabled and is visible. If a button is disabled or hidden, it will ignore the performClick message.

TechZen
Okay im stuck because I need to call stop: on a qcview but this can only be done from ib?
happyCoding25
happyCoding25: No, calling `stop:` cannot only be done from IB, partly because IB does not call the action methods you hook up in it. Any method that's listed in the documentation http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/QuartzFramework/Classes/QCView_Class/ , you can call.
Peter Hosey
Thanks I've tried using stopRendering before but it continues to run.
happyCoding25
A: 

You probably haven't hooked up your qcview outlet. Everything you've said is consistent with sending a message to nil, which does nothing and returns nil, Nil, NULL, NO, 0, or 0.0.

Peter Hosey
I have connected my QCView to the correct outlet.
happyCoding25
Then maybe you haven't loaded your nib. You can test both things at once by logging the pointer in the `qcview` outlet: `NSLog(@"qcview: %p", qcview);`
Peter Hosey