Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create dynamic label show by scrollview?
    primarykey
    data
    text
    <p>I tried show web service fields on some labels by select count.I am sorry my question is ver y large but I must solve this problem.</p> <p>I have some labels.</p> <p>Select "1" branch </p> <pre><code> Branch Name : XYZ Branch Product1 Product2 Product3 Product4 Sales Number 12 13 15 22 Liters 123 132 111 231 Price 123000 1243300 1929922 2232233 </code></pre> <p>Select "2" branch </p> <pre><code> Branch Name : ABC Branch Product1 Product2 Product3 Product4 Sales Number 17 18 17 44 Liters 123 132 111 343 Price 45454545 565656 34343434 2232323 </code></pre> <p>Outputs are here</p> <p>When select top 1 branch </p> <p><img src="https://i.stack.imgur.com/hjAQN.png" alt="enter image description here"></p> <p>When select top 2 branch</p> <p><img src="https://i.stack.imgur.com/DaKQS.png" alt="enter image description here"></p> <p>My question :It show me one by one.When I select top 1.branch it show me top 1.branch details. I want when I select top 10 from count it will be show me top 10 branches details from web service under and under by scrollview like tableview.</p> <pre><code> @interface ViewController () { NSMutableData *webData; NSXMLParser *xmlParser; NSMutableString *retornoSOAP; BOOL teveRetorno; NSMutableString *retornoSOAP1; BOOL teveRetorno1; } - (void)selectAnElection:(NSNumber *)selectedIndex element:(id)element; - (void)selectProducts:(NSNumber *)selectedIndex element:(id)element; - (void)selectCount:(NSNumber *)selectedIndex element:(id)element; @end @synthesize elections = _elections; @synthesize products = _products; @synthesize topnumber = _topnumber; -(void)viewDidLoad { NSMutableArray* topnumbershow = [NSMutableArray new]; self.elections= [NSArray arrayWithObjects:@"miktar", @"tutar", @"adet", nil]; self.products = [NSArray arrayWithObjects:@"KB95", @"Motorin", @"LPG",@"Toplam", nil]; for (int i = 1; i &lt;= 50; i++) { [topnumbershow addObject:[NSString stringWithFormat:@"%d", i]]; } self.topnumber= topnumbershow; </code></pre> <p>My picker buttons</p> <pre><code> - (IBAction)selectAnElection:(UIControl *)sender { [ActionSheetStringPicker showPickerWithTitle:@"Choose a election" rows:self.elections initialSelection:self.selectedIndex target:self successAction:@selector(selectAnElection:element:) cancelAction:@selector(actionPickerCancelled:) origin:sender]; } - (IBAction)selectProducts:(UIControl *)sender { [ActionSheetStringPicker showPickerWithTitle:@"Select a Products" rows:self.products initialSelection:self.selectedIndex target:self successAction:@selector(selectProducts:element:) cancelAction:@selector(actionPickerCancelled:) origin:sender]; } - (IBAction)selectCount:(UIControl *)sender { [ActionSheetStringPicker showPickerWithTitle:@"Top numbers ? " rows:self.topnumber initialSelection:self.selectedIndex target:self successAction:@selector(selectCount:element:) cancelAction:@selector(actionPickerCancelled:) origin:sender]; } </code></pre> <p>Show details button</p> <pre><code> -(IBAction) ShowDetails:(UIButton *)sender { NSString *mensagemSOAP= [NSString stringWithFormat:@"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n" "&lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema- instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;\n" "&lt;soap:Body&gt;\n" "&lt;TopBranches xmlns=\"http://tempuri.org/\"&gt;\n" "&lt;date1&gt;%@&lt;/date1&gt;\n" "&lt;date2&gt;%@&lt;/date2&gt;\n" "&lt;Elections&gt;%@&lt;/Elections&gt;\n" "&lt;Products&gt;%@&lt;/Products&gt;\n" "&lt;Count&gt;%@&lt;/Count&gt;\n" "&lt;/TopBranches&gt;\n" "&lt;/soap:Body&gt;\n" "&lt;/soap:Envelope&gt;\n", Date1.text,Date2.text,_ElectionsTextField.text, _ProductsTextfield.text,_CountTextField.text]; NSLog(@"SOAP Message = \n%@\n\n", mensagemSOAP); NSURL *url = [NSURL URLWithString:@"http://webservice:1249/topbranchdetails.asmx"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *tamanhoMensagem = [NSString stringWithFormat:@"%d", [mensagemSOAP length]]; [theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [theRequest addValue: @"http://tempuri.org/TopBranches" forHTTPHeaderField:@"SOAPAction"]; [theRequest addValue:tamanhoMensagem forHTTPHeaderField:@"Content-Length"]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody:[mensagemSOAP dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection *conexao = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if(conexao){ webData = [NSMutableData data]; }else{ NSLog(@"Connection Error."); } } </code></pre> <p>XML Parsing Processes</p> <pre><code> -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ [webData setLength: 0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [webData appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{ NSLog(@"Connection Error."); } -(void)connectionDidFinishLoading:(NSURLConnection *)connection{ NSLog(@"Bitti. Alinan Veri Byte: %d", [webData length]); NSString *xmlString = [[NSString alloc] initWithBytes: [webData mutableBytes] length: [webData length] encoding:NSUTF8StringEncoding]; NSLog(@"%@", xmlString); if (xmlParser) { xmlParser = nil; } xmlParser = [[NSXMLParser alloc] initWithData:webData]; [xmlParser setDelegate:self]; [xmlParser shouldResolveExternalEntities]; [xmlParser parse]; } int numberOfCount = 0; -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes: (NSDictionary *)attributeDict{ if ( [elementName isEqualToString:@"BranchName"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"BranchID"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"KB95Miktar"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"MotorinMiktar"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"LpgMiktar"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"MiktarToplam"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"KB95Adet"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"MotorinAdet"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"LpgAdet"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"AdetToplam"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"KB95Tutar"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"MotorinTutar"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"LpgTutar"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } if ( [elementName isEqualToString:@"TutarToplam"] ) { if (!retornoSOAP) { retornoSOAP = [[NSMutableString alloc] init]; } teveRetorno = YES; } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ if (teveRetorno) { [retornoSOAP appendString:string]; } } </code></pre> <p>Display web service fields on labels</p> <pre><code> - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if ( [elementName isEqualToString:@"BranchName"] ) { BranchName.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"BranchID"] ) { BranchID.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"KB95Miktar"] ) { K95MiktarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"MotorinMiktar"] ) { MotorinMiktarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"LpgMiktar"] ) { LPGMiktarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"MiktarToplam"] ) { ToplamMiktarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"KB95Tutar"] ) { K95TutarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"MotorinTutar"] ) { MotorinTutarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"LpgTutar"] ) { LPGTutarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"TutarToplam"] ) { ToplamTutarLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"KB95Adet"] ) { K95AdetLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"MotorinAdet"] ) { MotorinAdetLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"LpgAdet"] ) { LPGAdetLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } if ( [elementName isEqualToString:@"AdetToplam"] ) { ToplamAdetLabel.text = retornoSOAP; retornoSOAP = nil; teveRetorno = NO; } } - (void)selectAnElection:(NSNumber *)selectedIndex element:(id)element { self.selectedIndex = [selectedIndex intValue]; //may have originated from textField or barButtonItem, use an IBOutlet instead of element self.ElectionsTextField.text = [self.elections objectAtIndex:self.selectedIndex]; } - (void)selectProducts:(NSNumber *)selectedIndex element:(id)element { self.selectedIndex = [selectedIndex intValue]; //may have originated from textField or barButtonItem, use an IBOutlet instead of element self.ProductsTextfield.text = [self.products objectAtIndex:self.selectedIndex]; } - (void)selectCount:(NSNumber *)selectedIndex element:(id)element { self.selectedIndex = [selectedIndex intValue]; //may have originated from textField or barButtonItem, use an IBOutlet instead of element self.CountTextfield.text = [self.topnumber objectAtIndex:self.selectedIndex]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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