Search Results

Search found 30 results on 2 pages for 'zp26'.

Page 2/2 | < Previous Page | 1 2 

  • Problem with SIngleton Class

    - by zp26
    Hi, I have a prblem with my code. I have a viewController and a singleton class. When i call the method readXml and run a for my program update the UITextView. When i call the clearTextView method the program exit with EXC_BAD_ACCESS. The prblem it's the name of the variable position. This is invalid but i don't change anything between the two methods. You have an idea? My code: #import "PositionIdentifierViewController.h" #import "WriterXML.h" #import "ParserXML.h" #define timeToScan 0.1 @implementation PositionIdentifierViewController @synthesize accelerometer; @synthesize actualPosition; @synthesize actualX; @synthesize actualY; @synthesize actualZ; -(void)updateTextView:(NSString*)nomePosizione { NSString *string = [NSString stringWithFormat:@"%@",nomePosizione]; textEvent.text = [textEvent.text stringByAppendingString:@"\n"]; textEvent.text = [textEvent.text stringByAppendingString:string]; } -(IBAction)clearTextEvent{ textEvent.text = @""; //with this for my program exit for(int i=0; i<[[sharedController arrayPosition]count]; i++){ NSLog(@"sononelfor"); Position *tempPosition = [[Position alloc]init]; tempPosition = [[sharedController arrayPosition]objectAtIndex:i]; [self updateTextView:(NSString*)[tempPosition name]]; } } -(void)readXml{ if([sharedController readXml]){ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Caricamento Posizioni" message:@"Caricamento effettuato con successo" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; NSString *string = [NSString stringWithFormat:@"%d", [[sharedController arrayPosition]count]]; [self updateTextView:(NSString*)string]; //with only this the program is ok for(int i=0; i<[[sharedController arrayPosition]count]; i++){ NSLog(@"sononelfor"); Position *tempPosition = [[Position alloc]init]; tempPosition = [[sharedController arrayPosition]objectAtIndex:i]; [self updateTextView:(NSString*)[tempPosition name]]; } } else{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Caricamento Posizioni" message:@"Caricamento non riuscito" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; sharedController = [SingletonController sharedSingletonController]; actualPosition = [[Position alloc]init]; self.accelerometer = [UIAccelerometer sharedAccelerometer]; self.accelerometer.updateInterval = timeToScan; self.accelerometer.delegate = self; actualX=0; actualY=0; actualZ=0; [self readXml]; } - (void)dealloc { [super dealloc]; [actualPosition dealloc]; [super dealloc]; } @end #import "SingletonController.h" #import "Position.h" #import "WriterXML.h" #import "ParserXML.h" #define standardSensibility 2 #define timeToScan .1 @implementation SingletonController @synthesize arrayPosition; @synthesize arrayMovement; @synthesize actualPosition; @synthesize actualMove; @synthesize stopThread; +(SingletonController*)sharedSingletonController{ static SingletonController *sharedSingletonController; @synchronized(self) { if(!sharedSingletonController){ sharedSingletonController = [[SingletonController alloc]init]; } } return sharedSingletonController; } -(BOOL)readXml{ ParserXML *newParser = [[ParserXML alloc]init]; if([newParser startParsing:(NSString*)@"filePosizioni.xml"]){ [arrayPosition addObjectsFromArray:[newParser arrayPosition]]; return TRUE; } else return FALSE; } -(id)init{ self = [super init]; if (self != nil) { arrayPosition = [[NSMutableArray alloc]init]; arrayMovement = [[NSMutableArray alloc]init]; actualPosition = [[Position alloc]init]; actualMove = [[Movement alloc]init]; stopThread = FALSE; } return self; } -(void) dealloc { [super dealloc]; } @end

    Read the article

  • Problem with interaction servlet-jsp

    - by zp26
    Hi, I have a implementation prolbem. I have create a jsp and a servlet file. I have a remoteInterface of session bean. I wanna use remoteInterface in servlet and after write the data on the jsp. The client must see only the result page. For Example: A method of session bean return a Collection. I use this collection in the servlet and after this stamp all the element in the jsp. Can you help me with a code example. Thanks

    Read the article

  • Poblem with "CFDataRef".

    - by zp26
    Hello I have a problem with "CFDataRef. I get the "data" field from a "kCFSocketDataCallBack. "data" should correspond to a string received on the socket. How do I convert, for example, in a NSString so I can put my text in a textbox?? Thank you very much static void AcceptDataCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info) { //my code for the textBox }

    Read the article

  • constructor in objective c

    - by zp26
    HI, I have create my iPhone apps but i have a problem. I have a classViewController where i have implemented my program. I must alloc 3 NSMutableArray but i don't want do it in a grapich methods. There isn't a constructor like java for my class? Thanks so much and sorry for my english XP // I want put it in a method like constructor java arrayPosizioni = [[NSMutableArray alloc]init]; nomePosizioneCorrente = [NSString stringWithFormat:@"noPosition"];

    Read the article

  • error “EXC_BAD_ACCESS” in my programm

    - by zp26
    Hi, i have a problem. When i compile my program there isn't a error but, when i start it these retern with “EXC_BAD_ACCESS”. I looking for the error with the debug and i find it in these method but i don't understand where... Can you help me? Thanks and sorry for the english. PS:the program enters in the loop sometimes. -(void)updateMinPosition{ float valueMinX = 150; float valueMinY = 150; float valueMinZ = 150; NSString *nameMinimoX = [NSString stringWithFormat:@"default"]; NSString *nameMinimoY = [NSString stringWithFormat:@"default"]; NSString *nameMinimoZ = [NSString stringWithFormat:@"default"]; for(int i = 0; i< [arrayPosizioniMovimento count]; i++){ //Posizione is my class. It contain a NSString name, 3 float valueX, valueY, valueZ Posizione *tempPosition; tempPosition = [[Posizione alloc]init]; tempPosition = [arrayPosizioniMovimento objectAtIndex:i]; if(tempPosition.valueX <= valueMinX){ valueMinX = tempPosition.valueX; nameMinimoX = tempPosition.nome; } if(tempPosition.valueY <= valueMinY){ valueMinY = tempPosition.valueY; nameMinimoY = tempPosition.nome; } if(tempPosition.valueZ <= valueMinZ){ valueMinZ = tempPosition.valueZ; nameMinimoZ = tempPosition.nome; } [tempPosition dealloc]; } labelMinX.text = nameMinimoX; labelMinY.text = nameMinimoY; labelMinZ.text = nameMinimoZ; }

    Read the article

< Previous Page | 1 2