2

`Arrow display area which i want to prevent to click

Whenever i click on this area , action also perform on this.

riti
  • 255
  • 2
  • 11
Birju
  • 1,132
  • 11
  • 32

3 Answers3

4

Don't worry about this behavior, iOS auto tapp near element if there is not other element.

If you really want to prevent to click except button, then you have to put Element on unused area which should be inherited from UIControl or able to get UserInteraction.

Nayan
  • 3,014
  • 2
  • 17
  • 33
Mujah Maskey
  • 8,654
  • 8
  • 40
  • 61
1

I got solution. I put one UIButton between these two UIBarButtonItem and make it custom and nil it's selector.

Birju
  • 1,132
  • 11
  • 32
0

Also, you can try this: (Swift version)

    let btnName = UIButton()
    btnName.setImage(UIImage(named: "settings_filled_25"), forState: .Normal)
    btnName.frame = CGRectMake(0, 0, 30, 30)
    btnName.addTarget(self, action: Selector("toggleRight"), forControlEvents: .TouchUpInside)

    var rightView = UIView()
    rightView.frame = CGRectMake(0, 0, 30, 30)
    rightView.addSubview(btnName)

    let rightBarButton = UIBarButtonItem()
    rightBarButton.customView = rightView
    self.navigationItem.rightBarButtonItem = rightBarButton
haydark
  • 1
  • 1
  • 2