UIButton's Custom image and frame

Posted by Joo Park on Stack Overflow See other posts from Stack Overflow or by Joo Park
Published on 2010-05-08T01:27:45Z Indexed on 2010/05/08 1:38 UTC
Read the original article Hit count: 343

Filed under:
|

I have the following code.

UIImage *cancelImg = [UIImage imageNamed:@"cancel.jpeg"]; UIButton *btnCancel = [UIButton buttonWithType:UIButtonTypeCustom]; btnCancel.userInteractionEnabled = YES; [btnCancel setFrame:CGRectMake(0.0,0.0, 28.0, 28.0)]; [btnCancel setImage:cancelImg forState:UIControlStateNormal]; cell.accessoryView = btnCancel;

cancel.jpeg currently is bigger than 28 x 28 and it's actually 100 x 100.

Why does the button display 100 x 100 size of the image when I've set the UIButton's size to 28 x 28?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uibutton