Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 18, 2012, 12:40 PM   #1
loon3y
macrumors 6502a
 
Join Date: Oct 2011
Why Is My Image Not Showing Up (From Web Service)

(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



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
__________________
AppleLife
13" MacBook Pro 2.4 GHz 8 GB Ram 250 GB HD, iPod 5th Gen 32GB, iPhone 6 64GB, iPhone 5/S 64GB, iPhone 4/S 64 GB, iPhone 3GS 16 GB, iPad Air 16GB, iPad 3 16 GB Wi-Fi, Apple TV 3
loon3y is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad Mini: Multitasking Image Showing Deleted Film NOTmacbookpro13 iPad 6 Jan 10, 2014 01:57 PM
Some Retina iPad Minis Showing Image Retention Issues MacRumors MacRumors.com News Discussion 218 Nov 27, 2013 07:16 PM
Contact Image not showing soamz iPhone 0 Aug 30, 2013 05:15 AM
Web image game utahman130 Wasteland 31 Jul 16, 2012 05:14 PM
Airplay NOT showing image zerobrand OS X 10.8 Mountain Lion 1 Jul 13, 2012 08:57 PM

Forum Jump

All times are GMT -5. The time now is 07:54 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC