custom UIButton with skewed area in iPhone

Posted by sugar on Stack Overflow See other posts from Stack Overflow or by sugar
Published on 2010-05-27T06:31:20Z Indexed on 2010/05/27 6:41 UTC
Read the original article Hit count: 236

Filed under:
|
|
|
|

http://img16.imageshack.us/img16/225/ladibig.png

I want to have a button on a screen with this image. this image is transparent from its corners as you can see here.

UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
[btn setFrame:CGRectMake(xCo, yCo, kImageSizeWidth, kImageSizeHeight)];
[btn setImage:[UIImage imageNamed:@"aboveImg.png"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnTapped:) forControlEvents:UIControlEventTouchDown];

But the button tap is recognized out side image & i don't want that kind of functionality.

I mean tap must be recognized only when it is tapped within image not outside image.

How is that possible ?

Thanks in advance for sharing your great knowledge.

Sagar.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c