Programmatically draw back button with arrow?

ios, uibarbuttonitem, uinavigationbar

Solution

You can give the button a background image that makes it look like the native angled button:

testButton = [[UIButton alloc] initWithFrame:CGRectMake(80, 30, 160, 44)];
[testButton setTitle:@"Test Button" forState:UIControlStateNormal];
UIImage *buttonImage = [[UIImage imageNamed:@"angledButton"]  resizableImageWithCapInsets:UIEdgeInsetsMake(0, 16, 0, 16)];
[testButton addTarget:self action:@selector(buttonPressed:) forControlEvents: UIControlEventTouchUpInside];
[testButton setBackgroundImage:buttonImage forState:UIControlStateNormal];

You might need to tweak that, but it's in the right direction I believe.

Problem

Usually when you use a `UINavigationController` you get a back button that has an arrow on the left side of it. The thing is I am not using a UINavigationController so thats why I am asking. Anyway here is a picture: So far I have a regular `UIBarButtonItem` which currently is just square without that arrow on the left side of it. Is there a way to make a button that has an arrow on the left side like that and add it to my UINavigationBar? I have also looked around and it seems that UIButton type 101 is undocumented and will cause a rejection. I need a solution that will be accepted!

Original source