0
私はUITableView.Iと私のアプリでタブバーのコントローラを実装しようとしている3つのタブitems.AndこれはProduct Tabのスクリーンショットです。私はmycartに私の製品を追加しています。そして、カートに2つの商品を追加した後、これは私のMyCart Tabです。しかし、製品タブに戻り、商品を削除または追加してMyCartタブに戻った後も変更はありません。私はすべてのデータをviewWillAppear()メソッドにロードしました。ブレークポイントを使用すると、私のUITableViewデリゲートメソッドは、タブアイテムを変更するたびに1回だけ呼び出されることがわかりました。なぜUITableViewデリゲートメソッドは一度だけ呼び出されますか?
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
AppDelegate *delegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
handler = [delegate getHandler];
allProducts = [handler getAllProducts];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
productDataModel = [allProducts objectAtIndex:indexPath.row];
addToCartFlagNumber = (NSNumber*)productDataModel.productAvailability;
if([addToCartFlagNumber integerValue]){
static NSString *simpleTableIdentifier = @"ProductListTableViewCell";
ProductListTableViewCell *cell = (ProductListTableViewCell*) [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
cell.productListNameLabel.text = productDataModel.productName;
cell.productListImageView.image = [UIImage imageNamed:productDataModel.productImageName];
cell.productListDescriptionLabel.text = productDataModel.productDescription;
cell.addToCartButton.tagValue = [productDataModel.productID integerValue];
cell.addToCartButton.flagValue = 0;
return cell;
}
else{
static NSString *simpleTableIdentifier = @"UpcomingProductListTableViewCell";
UpcomingProductListTableViewCell *cell = (UpcomingProductListTableViewCell*) [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
cell.productListNameLabel.text = productDataModel.productName;
cell.productListImageView.image = [UIImage imageNamed:productDataModel.productImageName];
cell.productListDescriptionLabel.text = productDataModel.productDescription;
return cell;
}
}
あなたが表示された再読み込み可能なテーブルは表示されますか? –
@saurabhgoyal no.Ok私はそれを試しています。 – rafana
これまでに試したコードを投稿してください – remyr3my