struct data1 {
__ unsafe_unretained NSString * name;
__ unsafe_unretained NSString * telephone;
__ unsafe_unretained NSString * birthday;
__ unsafe_unretained NSString * QQ;
__ unsafe_unretained NSString * homepage;
} D;
and a variable array @ property (retain, nonatomic) NSMutableArray * temp;
Now, I want to join the D structure variable array temp in
the following error:
how to solve ? Hope the exhibitions !
------ Solution ---------------------------------------- ----
how to structure a struct variable into NSMutableArray in it ? Similar with the numerical variables , but this is to convert it to NSValue object.
Assuming structure :
struct testStruct {
int value1;
int value2;
};
deposit code
struct testStruct t;
t.value1 = 1;
t.value2 = 2;
/ / struct object will be loaded into the NSArray in
[testArray addObject: [NSValue value: & t withObjCType: @ encode (struct testStruct)]];
extracted code
struct testStruct p;
[[testArray objectAtIndex: 0] getValue: & p];
------ eference ----------------- ----------------------
find their own answers , and paste it on their own knot
没有评论:
发表评论