これをビューの didLoad メソッドに書き込みます。
UIImage* myimage = [UIImage imageNamed:@"ButtonImage.png"];
CGRect backFrame = CGRectMake(0, 0, 80, 30);
backButton = [[UIButton alloc] initWithFrame:backFrame];
[backButton setBackgroundImage:myimage forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(MyBtnclicked)
forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *btn = [[UIBarButtonItem alloc]initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem = btn;
ibaction を次のように記述します。
-(IBAction)MyBtnclicked
{
UIAlertView *av=[[UIAlertView alloc] initWithTitle:nil message:@"Do you really want to Go back" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes",nil];
[av show];
}