I can easily "do something", by creating an IBAction method, and connecting it to a button in IB. For example...
-(IBAction)popThat:(id)sndr{ [windy setFrame:eRect display:YES];}
However, I cannot, for the life of me, figure out how to do this via a simple, callable method... i.e.
-(void) popThatMethod { [windy setFrame:eRect display:YES]; }
-(void) awakeFromNib { [self popThatMethod]; }
I would expect that this method would DO the same thing as clicking the button... as they are identical... but NO. Nothing happens. What am I missing here?
I don't state that this is categorically the best answer, or the right way to do it, but one approach that works is to put the following in -applicationDidFinishLaunching:
:
[self performSelector: @selector(popWindow:) withObject:self afterDelay: 0.0];
This causes it to be called on the next pass of the runloop, by which time whatever was not in place before is now in place.
Depending on what you're trying to do, you might want
[buttonObj sendActionsForControlEvents: UIControlEventTouchUpInside];
Which triggers the button as if it had been touched, and forces whatever actions are connected to it.
NOTE: that's the answer from when I asked this SO question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With