I have a design app that allows the user to move images around to create a design. I want them to be able to save their designs.
How would I go about doing this.
Thank you
I have a design app that allows the user to move images around to create a design. I want them to be able to save their designs.
How would I go about doing this.
Thank you
プログラムで xib/nibs を生成することはできません。
代わりに、画像座標を plist ファイルとして保存することをお勧めします。plist ファイルには、オブジェクトの NSArray または NSDictionary を含めることができるため、(たとえば) 次のような座標の配列を作成します。
NSMutableArray *coordinates = [NSMutableArray array];
for (UIImageView *view in arrayOfImageViews)
{
NSString *position = NSStringFromCGPoint(view.center);
[coordinates addObject:position];
}
[coordinates writeToFile:someFileName atomically:YES];
次に、を使用して同じ方法でロードできます
NSArray *coordinates = [NSArray arrayWithContentsOfFile:filename];
次に、配列をループし、それを使用して画像ビューを再生成します。
画像名やその他のデータも plist に含める必要があるため、明らかにこれは単純化しすぎた例ですが、うまくいけばアイデアが得られます。配列にはおそらく実際には辞書が含まれており、それぞれに画像名と座標値が含まれています。