Objective C - Call another class -
Objective C - Call another class -
this question has reply here:
passing info between view controllers 33 answersi utilize class returns array next :
%hook firstheader -(void)firstmethod:(id)array{ nslog(@"array %@", array); homecoming %orig; } %end
the nslog result :
array ( "<secondheader: 0x17a2f3c0>", "<secondheader: 0x17a2f530>", "<secondheader: 0x17a2f5b0>", "<secondheader: 0x17a2f720>" )
bear me may sound dumb here; how can utilize result's array object secondheader
, secondheader
( or secondclass ) contains methods
summary : first class's method returns array objects, wants me utilize objects class/header secondheader
as per comment "first class's method returns array objects, wants me utilize objects class/header secondheader". declare property in secondheader
class as:
@property (nonatomic, retain) nsmutablearray * yourarray;
synthesize in .m file as:
@synthesize yourarray
and in first class
simple initialize instance of secondheader
set value yourarray as:
-(void)firstmethod:(id)array { nslog(@"array %@", array); secondheader * secondclass = [[secondheader alloc] init]; secondclass.yourarray = array; homecoming %orig; }
once array contents passed secondclass, can access array contents index as:
id obj = [yourarray objectatindex:1]; //id generic info type. should set right info type.
hope help. ofcourse there can other ways pass data, simplest way.
objective-c c xcode header-files theos
Comments
Post a Comment