views:

31

answers:

1

Really beginner question here.

I have an NSArray of images which in its last line has an error in Xcode saying that the "initializer element is not constant".

any help please?

+1  A: 

You're initializing your NSArray outside of a valid scope (ie, not inside a function or method).

For example, the following will produce your error:

NSArray * foo = [NSArray array];
int main(int argc, char * argv[]) {
  return 0;
}

To fix it, you'd do something like:

NSArray * foo = nil;
int main(int argc, char * argv[]) {
  foo = [NSArray array];
  return 0;
}
Dave DeLong
Thanks a lot, that worked, I am still a little used to java, trying to learn objective c and the iphone framework in parallel.I have a problem with the code, I am trying to load an image to set the background image depending on whether the user chooses next or previous button. I am calling the object at an index which I increment or decrement and I can see that the counter is increasing and decreasing accordingly when they press the buttons. What would the could look like to set the background of my view controller?
alJaree