i want a stretchable back button i’m now using this line of coding, this is giving me a back button but i want it stretchable with a custom title in it so i tried to add this line in the code
[button setTitle:@"back" forState:UIControlStateNormal];
But it didn’t work
UIImage *buttonImage = [[UIImage imageNamed:@"backButton.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 16, 0, 16)];
//create the button and assign the image
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
//buttonImage.size.width
//set the frame of the button to the size of the image (see note below)
button.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);
[button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
//create a UIBarButtonItem with the button as a custom view
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.leftBarButtonItem = customBarItem;
In the NavigationBar it display’s i need a title inside so it can stretch?

You have to use
setBackgroundImage:forStateinstead ofsetImage:forState:if you want your image to be stretchable.You should also set the width of the button to a higher value that allows your title to fit. As the image is stretchable, the button doesn’t have to have the same size as the image.