[space addBounds:self.view.bounds ....]

Discuss any Chipmunk bugs here.
Post Reply
whatever
Posts: 1
Joined: Mon Feb 20, 2012 12:28 am
Contact:

[space addBounds:self.view.bounds ....]

Post by whatever »

Hi I'm quite new to chipmunk. I started to follow the Simple Objective-Chipmunk Tutorial this morning. When I changed the button from a UIButton to a UIImageView, the bounds became weird. It was shifted left and down. Moreover, the shift amounts are different according to different image size.
Here's the only part that I changed:

Code: Select all

button = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pig.png"]];
button.backgroundColor = [UIColor blackColor];
button.bounds = CGRectMake(0, 0, SIZE, SIZE);
button.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(buttonClicked)];
[button addGestureRecognizer:tap];
When I tried to change the corner radians of the button, same thing happened again.
Any ideas?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: [space addBounds:self.view.bounds ....]

Post by slembcke »

Confusingly, different UIView objects (buttons, image views, etc) don't all have their centers and transforms set up the same. You might find this helpful:
http://chipmunk-physics.net/forum/viewt ... View#p5268
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests