I'm new to Objective-C.
If I wrote this method declaration in .h
-(void)myMethod;
and this implementation in .m
-(void)myMethod{
NSLog(@"This is myMethod");
}
How can I call it in my class' viewDidLoad
method?
Thank you.
Simply just use object "self"
[self myMethod];
Assuming that -viewDidLoad
is in the same class, use
[self myMethod];
self
here is an automatic reference to the current object instance. If you want to call a method on another object stored in a pointer otherObj
, it would be
[otherObj myMethod];
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