Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

Thread: Creating A Grid
View Single Post
Old 01-14-2010, 11:07 AM   #10 (permalink)
ng93
Registered Member
 
Join Date: Apr 2009
Location: Linslade, UK
Posts: 29
ng93 is on a distinguished road
Default

i haven't had time to test it but this should work:

Code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
	UITouch *touch = [touches anyObject];
	CGPoint touchPosition = [touch locationInView:self.view];
	CGFloat cellHeight = 20;
	CGFloat cellWidth = 20;
	int amountCellsWidth = 50;
	int amountCellsHeight = 50;
	for (int x=0; x<amountCellsWidth; x++) {
		for (int y=0; y<amountCellsHeight; y++) {
			if (touchPosition.y > y*cellHeight && touchPosition.y < (y+1)*cellHeight && touchPosition.x > x*cellWidth && touchPosition.x < (x+1)*cellWidth) {
				[cell[x][y] setImage:yourImage];
			}
		}
	}
}
ng93 is offline   Reply With Quote
 

» Advertisements
» Online Users: 443
16 members and 427 guests
David-T, edvaniojancy, givensur, HemiMG, iAppDeveloper, iGuessSo, jcfisher, jimmyon122, Kirkout, PixelEnvision, Punkjumper, revg, RickSDK, Sloshmonster, speed4mee, thebeast
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,431
Threads: 94,026
Posts: 402,586
Top Poster: BrianSlick (7,978)
Welcome to our newest member, edvaniojancy
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:08 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.