Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

loon3y

macrumors 65816
Original poster
Oct 21, 2011
1,235
126
i have a global variable "prodTableArray" which is a barcode string that converts itself into an array so it can show the product number in the tableview. as sort of a shopping cart list.


but it pulls the barcode from the first view controller and it doesn't automatically show up in my tableview unless i rotate it, i also have a similar problem with with a UIImageView on another view controller except that i added a button to retrieve the image.

but i want to get rid of the button and do it automatically, is this possible?


heres my table code, how can it automatically update after each barcode scan, i know view willappear works but than the user is going to have to click on another view controller and click back to load the image.


Code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    ImageStrings* theDataObject = [self theImageClass];
    // Return the number of rows in the section.
    return [theDataObject.prodTableArray count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
     ImageStrings* theDataObject = [self theImageClass];
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    
    cell.textLabel.text = [theDataObject.prodTableArray objectAtIndex:[indexPath row]];
    

    
    return cell;
}
 
Last edited:
Have you read the UITableView documentation? Do you understand exactly when those two methods are called?
 
Have you read the UITableView documentation? Do you understand exactly when those two methods are called?

yes, thank you I've just read it and found the reloading method.

tyvm
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.