首先,我得到了一些產品來自IAP如何根據價格對產品進行分類在App Purchase中?
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
[productDetailsList addObjectsFromArray: response.products];
[productDisplayTableView reloadData];
}
如何把它們放在一個UITableView按產品價格是多少?謝謝。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *GenericTableIdentifier = @"GenericTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: GenericTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:GenericTableIdentifier] autorelease];
}
SKProduct *thisProduct = [productDetailsList objectAtIndex:row];
NSUInteger row = [indexPath row];
[button setTitle:localizedMoneyString forState:UIControlStateNormal];
[cell.contentView addSubview:button];
return cell;
}
您好,我有一個錯誤的原因:「 - [SKProduct比較:]:無法識別的選擇發送到實例0x2e2ee0」 – jean 2012-01-31 07:30:36
裏面你SKProduct沒有你實現可以做到以上的比較函數? '比較(id arg1,id arg2,void * context)'?如果arg1 arg2返回NSOrderedDescending,並且如果arg1 == arg2返回NSOrderedSame。一旦你在SKProduct中實現了這個功能,你可以調用'[productDetailList sortedArrayUsingFunction:compare context:NULL];'並且應該可以工作,如果不行請發表更多的結果和/或你的代碼。 –
2012-01-31 08:02:43