ViewController にテーブルがあります。このテーブルでは、webService と CoreData から情報を取得します。この情報は各行に表示されます。各行を押すと、詳細ビューに移動して画像を作成します。
私はカードを持っていて、各カードには異なるスタンプがあります。detailView に行くとき、この画像を作成したいです。つまり、カードに 2 つのスタンプがある場合は 2 つの画像を作成し、3 つのスタンプがある場合は 3 つの画像を作成したいということです。 、
この実装で私を助けてください、事前に感謝します!
Web サービスから取得した情報は次のとおりです。
createdAt = 1362412409;
id = 2;
stampNumber = 2;
},
{
createdAt = 1362069567;
id = 1;
stampNumber = 10;
}
ここに私のコードがあります:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath
{
static NSString *CellIdentifier = @"CardsCell";
CardCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
NSArray *objects = [[NSBundle mainBundle] loadNibNamed:@"CardCell" owner:nil
options:nil];
for (id currentObject in objects)
{
if([currentObject isKindOfClass:[UITableViewCell class]])
{
cell = (CardCell *) currentObject;
break;
}
}
}
card = self.cards[indexPath.row];
cell.stampId.text = [[NSString alloc] initWithFormat:@"%@",card.stampNumber];
cell.createdAt.text = [[NSString alloc] initWithFormat:@"%@",card.createdAt];
cell.CardId.text = [[NSString alloc] initWithFormat:@"Carte %d",(indexPath.row+1)];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[[NSNotificationCenter defaultCenter] postNotificationName:@"cardDetail" object:nil
userInfo:nil];
}
私の質問は、スタンプに基づいてプログラムでこの写真を作成する方法です..
編集: 私はこの画像を持っています:
UIImageView *stampIMG = [[UIImageView alloc] initWithFrame:self.view.frame];
stampIMG = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1.jpg"]];
stampIMG.frame = CGRectMake(0, 0, 122, 122);
この画像だけ使いたい