3

iOSカスタムUINavigationItem leftBarButtonItemホットスポットの範囲が大きすぎます

UIButton *modalViewButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage* imagex = [UIImage imageNamed:@"btn_backX1.png"];
[modalViewButton addTarget:self
                    action:@selector(backAction:)
          forControlEvents:UIControlEventTouchUpInside];
[modalViewButton setImage:[UIImage imageNamed:@"btn_backX1.png"] forState:UIControlStateNormal];
//image size is 35X34
[modalViewButton setFrame:CGRectMake(0, 0, imagex.size.width, imagex.size.height)];
UIBarButtonItem *modalBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:modalViewButton];
self.navigationItem.leftBarButtonItem = modalBarButtonItem;
[modalBarButtonItem release];

UIView左上UINavigationBarのをクリックするleftBarButtonItem と、アクションが実行されます。真ん中をクリックするとUINavigationBarleftBarButtonItemアクションも。ホットスポットの範囲を変更して小さくするにはどうすればよいですか?

4

0 に答える 0