Displaying indexed png- files out of NSArray on the iphone screen
Posted
by Thomas Hülsmann
on Stack Overflow
See other posts from Stack Overflow
or by Thomas Hülsmann
Published on 2010-03-27T11:27:02Z
Indexed on
2010/03/27
11:33 UTC
Read the original article
Hit count: 442
Hi,
i like to create an artwork counter- display on an iphone, diplaying 0 to 9. The 10 digits are 10 png- files with the numbers 0 to 9 as their artwork content. The 10 png- files are implemented by using NSArray. Following you'll find the implementation- code:
zahlenArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"ziffer-0.png"],
[UIImage imageNamed:@"ziffer-1.png"],
[UIImage imageNamed:@"ziffer-2.png"],
[UIImage imageNamed:@"ziffer-3.png"],
[UIImage imageNamed:@"ziffer-4.png"],
[UIImage imageNamed:@"ziffer-5.png"],
[UIImage imageNamed:@"ziffer-6.png"],
[UIImage imageNamed:@"ziffer-7.png"],
[UIImage imageNamed:@"ziffer-8.png"],
[UIImage imageNamed:@"ziffer-9.png"],
nil];
As an index for the 10 digitis I use an integer variable, initializing with 0:
int counter = 0;
Furthermore I declare an UIImageview programmaticaly:
UIImageView *zahlenEinsBisNeun;
The implementation code for the UIImageview is:
zahlenEinsBisNeun = [UIImage alloc] initWithFrame:CGRectMake(240, 50, 200, 200)];
????????????????????????????????????????
[self.view addSubview:zahlenEinsBisNeun];
[zahlenEinsBisNeun release];
There, where you see the questionmarks, I don't know how to write the code, to retrieve my content artworks 0 to 9 from NSArray with the index "counter" and make it visible on my iphone screen by using .... addSubview:zahlenEinsBisNeun ...
Can anybody help???
My thanks for your support in advance
Thomas Hülsmann
© Stack Overflow or respective owner