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

View Single Post
Old 02-09-2010, 03:14 PM   #1 (permalink)
nibby
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
 

» Advertisements
» Online Users: 291
22 members and 269 guests
ADY, apatsufas, BdR, Diegan, djohnson, Duncan C, F_Bryant, glenn_sayers, Guthook, Herbie, ilmman, Joseph Nardone, Music Man, NSeven, Profile, rodgo, TheWebWizz, VikMyr, vogueestylee, yomo710, zbynda, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,708
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

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