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

Discuss any Chipmunk bugs here.

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

Postby whatever » Mon Feb 20, 2012 1:40 am

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?
Posts: 1
Joined: Mon Feb 20, 2012 12:28 am

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

Postby slembcke » Mon Feb 20, 2012 12:52 pm

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:
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest