I try with a normal big size icon, not resized at all, and the UIBarButtonItemStyleBordered works:
UIBarButtonItem *compassButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"compass.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(compassButtonPressed:)];
compassButtonItem.enabled = YES;
self.navigationItem.rightBarButtonItem = compassButtonItem;
Then I try to resize the image to 20x20, using a UIButton and a CGRectMake, the border doesn't work:
UIButton *compassButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
UIImage *compassImage = [UIImage imageNamed:@"compass.png"];
[compassButton addTarget:self action:@selector(compassButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[compassButton setImage:compassImage forState:UIControlStateNormal];
[compassButton setImage:compassImage forState:UIControlStateSelected];
UIBarButtonItem *compassButtonItem = [[UIBarButtonItem alloc] initWithCustomView:compassButton];
compassButtonItem.style = UIBarButtonItemStyleBordered;
compassButtonItem.enabled = YES;
self.navigationItem.rightBarButtonItem = compassButtonItem;
Any ideas how to use the UIBarButtonItemStyleBordered with an UIImage resized?.