Hey everyone, this is an EXTREMELY beginner question, and I’m somewhat ashamed I don’t know it already: How can I execute code just once at the implementation of my object? I have an object that’s of a subclass of UIView I want some code to be executed as soon as everything kicks off, but I’m only able to get code to be executed in response to user input. ARGHH!
I though -(void)viewDidLoad would work, but to no avail…
Any help is, of course, greatly appreciated. I hate not knowing something so simple at this point.
Thanks!
The viewDidLoad method is defined on UIViewController, not on UIView, so there’s no reason to expect it to be called in a UIView subclass unless you call it yourself.
If you’re creating the view in code, you’ll want to look at
-initWithFrame:. If you’re using IB, use-initWithCoder:.