I am trying to pass a uitextfield string from a view controller over to a method in a nsobject class… if you could please explain how I do this that would be great.
So far I have done the following however still getting lots of errors.
NSObject Class dbAccess.h
- (void)passCode:(NSString *)passedCode;
NSObject Class.m
- (void)passCode:(NSString *passedCode {
myString = passedCodeVaraibel; //myString declared in .h
}
//… other code to initialize the database. with myString or something to that effect even though this is probably wrong this is why im asking the question
viewController.m
//pass myCode textfield string when uitableviewcell is selected.
[dbAccess.passCode myCode.text];
I know this is not right because its not working 🙂 but I hope it adds more detail as to what I am trying to do.
Standard objective-c convention would request that you change the method name to
setPassCode:, howeverpassCode:works perfectly fine.i assume this code isn’t compiling,
to correctly invoke a method, you use the following syntax (several examples):
if you want to set a value, obviously you want to pass in that value as a parameter