Note that there are some explanatory texts on larger screens.

plurals
  1. POError on displaying NSArray objectAtIndex into UILabel
    primarykey
    data
    text
    <p>Despite many tries I have already done.. I am not getting to display correctly items from an NSArray into a UILabel..</p> <p>When I NSLog the array the console returns me this:</p> <pre><code>2013-01-19 14:34:32.799 bloom[2766:c07] ( "0.877" ) </code></pre> <p>Which is the value I fetched from a website and parsed and etc..</p> <p>The problem is that when I display it in a UILabel it shows me exactly the same thing and I need just the value without quotes to be displayed. Here's is how it is displaying:</p> <p><img src="https://i.stack.imgur.com/G4VdI.png" alt="Displaying problem"> </p> <p>Edit:</p> <p>Here is my code:</p> <pre><code>- (void)configureView { // Update the user interface for the detail item. if (self.detailItem) { for (NSDictionary *valuesDatum in _detailItem) { NSDictionary *itemAtIndex = (NSDictionary *)_detailItem; self.title = [itemAtIndex objectForKey:@"SYMBOL"]; NSString *strUrl = @"http://www.bloomberg.com/quote/"; NSString *ativo = [itemAtIndex objectForKey:@"SYMBOL"]; NSString *consulta = [strUrl stringByAppendingString:ativo]; NSURL *url = [NSURL URLWithString:consulta]; NSData *webData = [NSData dataWithContentsOfURL:url]; NSString *xPathQuery = @"//span[@class=' price'] | //span[@class=' trending_up up'] | //span[@class=' trending_up up']/span | //table[@class='snapshot_table']/tr/td"; TFHpple *parser = [TFHpple hppleWithData:webData isXML:NO]; NSArray *array = [parser searchWithXPathQuery:xPathQuery]; valores = [[NSMutableArray alloc]init]; for (TFHppleElement *element in array) { [valores addObject:[[element firstChild] content]]; } novosValores = [[NSMutableArray alloc]init]; for (NSString *valuesDatum in valores) { NSString *removeNewLine = [[valuesDatum componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@" "]; NSString *removeSpace = [removeNewLine stringByReplacingOccurrencesOfString:@" " withString:@""]; NSString *removeSpaceOne = [removeSpace stringByReplacingOccurrencesOfString:@" " withString:@""]; NSString *trocaVirgulaPonto = [removeSpaceOne stringByReplacingOccurrencesOfString:@"," withString:@"."]; [novosValores addObject:trocaVirgulaPonto]; } valoresFinais = [[NSMutableArray alloc]init]; for (NSString *valuesDatum in novosValores) { NSArray *val = [valuesDatum componentsSeparatedByString:@" - "]; [valoresFinais addObject:val]; } infos = [[NSMutableArray alloc]init]; for (NSArray *dados in valoresFinais) { NSArray *arrayDados = [[NSArray alloc]initWithArray:dados]; for (NSString *teste in arrayDados) { NSArray *arrayTeste = [teste componentsSeparatedByString:@","]; [infos addObject:arrayTeste]; } } NSLog(@"%@",[infos objectAtIndex:0]); NSString *fff = [[NSString alloc] initWithFormat:@"%@", [infos objectAtIndex:0]]; [_detailDescriptionLabel setText:fff]; } } } </code></pre> <p>NEW EDIT:</p> <p>I have this array:</p> <pre><code>2013-01-19 15:43:05.055 bloom[3564:c07] ( "7.730", "0.020", "0.26%", "7.750", "7.650-7.800", "2.333.100", "7.710", "3.730-8.810", "+4.04%" </code></pre> <p>)</p> <p>All I need is a new array with the data from lines 5 and 8 separated by the "-".</p> <p>So anyone has a light??</p> <p>Thanks!!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload