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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-09-2010, 03:14 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 12
Default Getting object properties from UIImageView

Hi all

I am having trouble finding the properties for an custom object i made and added to an UIImageView. See the code below.

This is the interface for my custom class, for now it only holds the location of my UIImageView.
Code:
@interface monsterImage : UIImageView {
	CGPoint startLocation;
}
@property(nonatomic) CGPoint startLocation;
@end
Here i add the view
Code:
CGRect myImageRect = CGRectMake(50, 50, 65, 65);
monsterImage *myImage = [[monsterImage alloc] initWithFrame:myImageRect];
myImage.opaque = YES;
[myImage setUserInteractionEnabled:YES];
[myImage setImage:[UIImage imageNamed:@"Monster.png"]];
[myImage setStartLocation:CGPointMake(50,50)]; //set location on monsterImage object.
[self.view addSubview:myImage];
In my touchesBegan i would like to do something like this:
Code:
UITouch *touch = [touches anyObject];
NSLog(@"UIImageView touched.");
// line below does not compile!
NSLog(@"Location: %i,%i", (int) [[touch view] startLocation].x, (int)[[touch view] startLocation].y);
Since the view is just an UIImageView getting startLocation is not working, but how do i get a hold of my "monsterImage" object which i added as a subview above?

Thanks in advance for any help.
nibby is offline   Reply With Quote
Old 02-10-2010, 01:36 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 12
Default

If anyone have an alternative way to put properties somewhere in my UIImageView so i can extract them when the UIImageView is touched, i'd love to hear suggestions - this is just the way i thought was the easiest.
nibby is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 158,484
Threads: 89,092
Posts: 380,130
Top Poster: BrianSlick (7,091)
Welcome to our newest member, lavernwatts
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:54 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0