Mixing Objective C and C in switch statement trying to add a subview iphone SDK -


I have a strange problem. I have a loop in my loop, there is a switch statement inside the I loop counter one pointer Which indicates the beginning of an initial array, until it gets "Terminator number", it increases, the seen array is used to create a view, to put each element in a view Represent SubViews. Here's the code:

 for  (self.composizon; * composizione> gt; kFine; composizione ++) {int c = (int) * composizione; NSLog (@ "% d", c); Switch (C) {Case kForchettaPesce: Case kForchettaNormale: {NSString * imagePath; ImagePath = [[NSString alloc] initWithFormat: @ "% @ /% d.png", [[NSBundle main bundle] resource path], C]; UIImage * image = [[UIImage alloc] initWithContentsOfFile: imagePath]; [Imagepath release]; NSLog ("pippo" @); UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (0, 0, image.size.width, image.size.height)]; ImageView.image = Image; [Image release]; [Self.view addSubview: imageView]; [See image release]; break; } Default: Break; } NSLog (@ "% d", (int) * composizione); }  

Debugging it I have found that until it does not try to add the subview. It sticks in the loop and the log always shows the same data in an infinite cycle. If I remove the AddSubview method, I have no problem, so the log statement shows what I expect to see. What am I doing wrong? Regards, Andrea

I'm not sure what you are trying to do, but it can be Is that you 'like mixing your types:

 for  (self.composizon; * composizione> gt; kFine; composizione ++) {int c = (int) * composizione;  
  • For self.composizione ( is unnecessary, it does nothing, does it? < Li> * composexon is the value that is indicated by composizione , which should be int * (is?)
  • The Indicator advance value 's * composizione in composizione ++ memory next place

In short: You might need composizione ++ instead of (* composizione) ++ .

< / Html>

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -