"Clark Kent" said:...utrpat podatke u xml i poslat url na taj xml.
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://path.do/file.xml"]];
NSLog(@"Trenutno je odabran %d. segment", starsSegmented.selectedSegmentIndex);
if(starsSegmented.selectedSegmentIndex==0)
stars = @"All";
else stars = [NSString stringWithFormat:@"%d",i];
msg=[[NSString alloc] initWithFormat:@"I'm going to %@, more expensive then %@€ and cheaper then %@€ in hotel with at least %@ stars!", dest, least, most, stars];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Search Criteria" message:msg delegate:self cancelButtonTitle:@"That's it!" otherButtonTitles:nil];
[alert show];
[alert release];
...
2010-06-04 10:26:02.789 ZavrsniNav[4687:207] Trenutno je odabran 2. segment
Current language: auto; currently objective-c
(gdb) continue
(gdb) continue
Program received signal: “EXC_BAD_ACCESS”.
(gdb)
int a=[string intValue]
Program received signal: “EXC_BAD_ACCESS”.
msg=[[NSString alloc] initWithFormat:@"I'm going to %@, more expensive then %@€ and cheaper then %@€ in hotel with at least %@ stars!", dest, least, most, stars];
-(void)actionSheet:(UIActionSheet *)actionSheet
didDismissWithButtonIndex:(NSInteger)buttonIndex{
if (!buttonIndex == [actionSheet cancelButtonIndex])
{
NSString *msg = nil;
if (nameField.text.length > 0)
msg=[[NSString alloc] initWithFormat:
@"You can breathe easy, %@, everything went OK.", nameField.text];
else
msg=@"You can breathe easy, %@, everything went OK.";
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Something was done"
message:msg
delegate:self
cancelButtonTitle:@"Phew!"
otherButtonTitles:nil];
[alert show];
[alert release];
[msg release];
}
}
-(void)search:(id)sender{
NSString *msg = nil;
NSString *dest = nil;
NSString *stars = nil;
NSString *least = @"ZERO";
NSString *most = @"INFINITE";
int br = 0;
int i = starsSegmented.selectedSegmentIndex;
if(destinationField.text.length>0){
dest=destinationField.text;
br++;}
else dest=@"Anywhere";
if(leastField.text.length>0){
least=leastField.text;
br++;}
else least=@"ZERO";
if(mostField.text.length>0){
most=mostField.text;
br++;}
else most = @"INFINITE";
NSLog(@"Trenutno je odabran %d. segment", starsSegmented.selectedSegmentIndex);
if(starsSegmented.selectedSegmentIndex==0)
stars = @"All";
else{ stars = [NSString stringWithFormat:@"%d",i+2];
br++;}
NSLog(@"stars=%@", stars);
if(br>0)
msg=[[NSString alloc] initWithFormat:@"I'm going to %@, more expensive then %@€ and cheaper then %@€ in hotel with at least %@ stars!",
dest, least, most, stars];
else msg=@"I'm going anywhere!";
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Search Criteria"
message:msg delegate:self cancelButtonTitle:@"That's it!" otherButtonTitles:nil];
NSLog(@"destination=%@",dest,
"least=%@",least,
"most=%@",most,
"stars=%@", stars);
[alert show];
[alert release];
[msg release];
[dest release];
[least release];
[most release];
[stars release];
}
for(int i=0; i< [appDelegate.hotels count];i++)
{
aHotel = [appDelegate.hotels objectAtIndex:i];
NSLog(@"Info for hotel:%@",aHotel.name);
if(
((aHotel.location==searchDest)
||([searchDest isEqualToString:@"Anywhere"]))
&&([aHotel.price intValue]>=searchLeast)
&&([aHotel.price intValue]<=searchMost)
&&(
([aHotel.stars intValue]==[searchStars intValue])
||([searchStars isEqualToString:@"All"])))
{
[containsSearch addObject:aHotel];
NSLog (@"Dodan je hotel: %@",aHotel.name);
NSLog (@"%d",[containsSearch count]);
}
}