0
UITableView.I에 3 개의 탭 항목이있는 앱에서 탭 표시 줄 컨트롤러를 구현하려고합니다. 그리고 이것은 Product Tab의 스크린 샷입니다. 내 제품을 mycart에 추가하고 있습니다. 그리고 내 장바구니에 두 개의 제품을 추가하면 이것이 내 MyCart Tab입니다. 그러나 제품 탭으로 돌아가 제품을 제거하거나 추가 한 다음 MyCart 탭으로 돌아 가면 변경되지 않습니다. 모든 데이터를 viewWillAppear() 메소드에로드했습니다. 중단 점을 사용하여 내 UITableView 대리자 메서드를 한 번만 내 탭 항목을 변경할 때마다 호출 된 것을 발견했습니다.왜 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