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左上角下UINavigationBarleftBarButtonItem 时,将执行此操作。如果我点击中间UINavigationBarleftBarButtonItem动作也是如此。如何修改热点范围以使其更小?

4

0 回答 0