i’m new, so i cann’t upload the image, but i have a problem when i customize the backButtonItem in iOS
the code i write:
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *backBtnImage = [UIImage imageNamed:@"backBtn.png"];
backBtn.frame = CGRectMake(0, 0, backBtnImage.size.width, backBtnImage.size.height);
[backBtn setBackgroundImage:backBtnImage forState:UIControlStateNormal];
backBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[backBtn addTarget:self action:@selector(popBack) forControlEvents:UIControlEventTouchUpInside];
[backBtn setTitle:@"Back" forState:UIControlStateNormal];
UIBarButtonItem *backBtnItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
[backBtnItem setStyle:UIBarButtonItemStyleDone];
self.navigationItem.leftBarButtonItem = backBtnItem;
but the title with “back” is not aligned on the backButton.
How could i align the title of a backbuttonitem which has been customized?
Try with this: