5/01/2009

UITableViewController and copy, hooray!

Managed to use UITableViewController alright. I understood the concept of the copy method. I needed to copy the object with a new pointer from the items list. Before, I was just copying the pointer. It took me 3 hours of research how to copy object properly.
UITableViewControllerうまくいった。newItem = [aItem copy]しないとだめと気づく&リサーチで3時間ぐらいかかった。


- (id)copyWithZone:(NSZone *)zone {
id aCopy = [[[self class] alloc] init];
[aCopy setItemAbundancyPercent:[self itemAbundancyPercent]];
[aCopy setItemPrice:[self itemPrice]];
[aCopy setItemCategory:[self itemCategory]];
[aCopy setItemName:[self itemName]];
[aCopy setItemWeapon:[self itemWeapon]];
[aCopy setEffectPower:[self effectPower]];
[aCopy setItemAttributeNumber:[self itemAttributeNumber]];
[aCopy setItemDescription:[self itemDescription]];
[aCopy setIsEquipped:[self isEquipped]];
return aCopy;
}

No comments:

Post a Comment