この player.type.property のような結果が欲しいです。この例は、UILabel、self.label.text を使用したものです。.text は 2 つのクラスのプロパティです。
私が持っていた提案は、次のようなことをすることです:
player.type = [[MyCustomObject alloc] init];
player.type.property = @"value";
これを正しく行う方法が正確にはわかりませんが、私が試したすべての方法がうまくいきません。
これが私が試したことです:
Marketplace.h
#import "Item.h"
@interface Marketplace : NSObject
@property (nonatomic, assign) Item *market;
Item.h
@interface Item : NSObject
@property (nonatomic, assign) int price;
Starter.m
#import "Marketplace.h"
#import "Item.h"
@implementation MainGameDisplay
{
Marketplace *market;
Item *itemName;
}
-(void) executedMethod {
market.itemName = [[market alloc] init];
//2 errors: "Property 'itemName not found on object of type 'MarketPlace'" and "No visible @interface for 'MarketPlace' declares the selector alloc"
market.itemName.price = 5; //"Property 'itemName' not found on object of type 'Marketplace*'"
}