Stephen Healey
Stephen Healey

Reputation: 53

Creating a custom uibarbuttonitem, button image wrong

I am trying to create a custom UiBarButtonItem. When I build the project on IOS simulator, the custom buttons proportions are all wrong. I have tried different sizes of image and they all don't work. What am I doing wrong?

Example

 UIImage *image = [[UIImage imageNamed:@"facebookbutton4.png"]  resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];

 authButton =
[[UIBarButtonItem alloc] initWithImage:image
                                 style:UIBarButtonItemStylePlain
                                target:self
                                action:@selector(authButtonAction:)];

self.navigationItem.leftBarButtonItem = authButton;

The current image is 74 x 46 pixels, resolution 952 pixels per inch. Im having difficulty trying to set the resolution properly, i'm using iDraw for mac. What resolution should the image be?

Upvotes: 1

Views: 441

Answers (1)

nikkumang
nikkumang

Reputation: 1635

Here's Apple's guidelines - 20x20 points so try 40x40px 72DPI for your retina @2x, 20x20px for normal.

Upvotes: 1

Related Questions