iphone - Objective-C (iOS) Access UITextField's text from another class -
this question extremely basic , apologize if answer should staring me in face.
so: have uitableview , viewcontroller. i'm updating information coredata in uitableview's .m file. in order need text in text field in other viewcontroller.
so being rather inexperienced, tried:
[entity setname:[nsstring stringwithformat:@"%@", viewcontroller.entitynameinputfield.text]];
i've renamed few things clarity. entity entity (no kidding), attribute i'm setting called name, viewcontroller textfield , text field called entitynameinputfield.
i'm lot more interested in why sort of thing doesn't work solution problem might be. why can't text text field in way?
i suppose word differently:
if i'm in class , want access value of say, nsstring in class b, why can't use classa.thestring or [classa thestring] .... i've managed understand, i'm sending these objects getter methods , can't seem see why doesn't work...
any appreciated :)
some more code useful see might causing confusion, if have declared properties in classes associated instance variables (or have manually declared accessors) able access associated ivars.
so, (below) work fine.
myclassa * instanceofa = [[myclassa alloc] init]; myclassb * instanceofb = [[myclassb alloc] init]; instanceofa.myproperty = instanceofb.myproperty;
Comments
Post a Comment