(Tabbar App)
im calling a web service in my first viewcontroller and I'm trying to set it to an array and make it appear on my salesviewcontroller's table
salesIMG.styleImage is the global variable where im storing my data, and heres the coding for my tableview in the salesVIewController
it worked for the other app, im not sure why it doesnt work. i need to do this because there is a 5-8 second delay when i press the the salesviewcontroller tab, because before i was calling the webservice everytime to show the image
im calling a web service in my first viewcontroller and I'm trying to set it to an array and make it appear on my salesviewcontroller's table
Code:
if ([elementName isEqualToString:@"itemno"])
{
displayText.text = capturedCharacters;
if([capturedCharacters isEqualToString:@""])
{
}
else
{
theDataObject.prodCode = capturedCharacters;
NSString *sURL = [[NSString alloc] initWithString:[NSString stringWithFormat:@"%@%@.jpg", theDataObject.imageURL, salesIMG.salesCode]];
NSData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",sURL ]]];
salesIMG.styleImage = [[UIImage alloc] initWithData:mydata];
}
}
salesIMG.styleImage is the global variable where im storing my data, and heres the coding for my tableview in the salesVIewController
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
GlobalStrings* theDataObject = [self theGlobalClass];
static NSString *CellIdentifier = @"SalesCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
Sale *mySale = [Sale alloc];
mySale = [theDataObject.prodTableArray objectAtIndex:[indexPath row]];
UILabel *codeLabel = (UILabel *) [cell viewWithTag:100];
codeLabel.text = mySale.salesCode;
UILabel *descriptLabel = (UILabel *) [cell viewWithTag:101];
descriptLabel.text = mySale.salesDescript;
UILabel *priceLabel = (UILabel *) [cell viewWithTag:103];
priceLabel.text = mySale.salesPrice;
UIImageView *salesImageView = (UIImageView *) [cell viewWithTag:102];
UILabel *quantityLabel = (UILabel *) [cell viewWithTag:104];
quantityLabel.text = mySale.salesQuantity;
salesImageView.contentMode = UIViewContentModeScaleAspectFit;
salesImageView.image = mySale.styleImage;
return cell;
}
it worked for the other app, im not sure why it doesnt work. i need to do this because there is a 5-8 second delay when i press the the salesviewcontroller tab, because before i was calling the webservice everytime to show the image