0

I have a view controller with 1 leftBarButtonItem and 2 rightBarButton Items.

I have implemented them using this code.

@IBOutlet weak var menuButtonLeft:UIBarButtonItem!
 @IBOutlet weak var menuButtonRight: UIBarButtonItem!

 var search = UIBarButtonItem(image: UIImage(named: "search.png"), style: UIBarButtonItemStyle.Plain, target:self, action: "activateSearch")
    self.navigationItem.rightBarButtonItems = NSArray(objects: menuButtonRight,search)
    self.navigationItem.setRightBarButtonItems([menuButtonRight,search], animated: true)

The menuButtonRight and menuButtonLeft have been added in storyboard. But as i wanted one more right button, i added it programmatically seeing SO questions and this search button is visible when i run the app, bt does not appear in the storyboard.

But now I want to perform a segue from this search button.

The main intent here is to call a newViewController when the search button is pressed.

I was thinking of calling the newViewController directly when the button is clicked. bt m not able to figure out how to do it.

Pls throw some light on this

Swapna Lekshmanan
  • 514
  • 10
  • 30

1 Answers1

0

Create a segue from the controller (the one with the bar buttons) to the controller you want to segue to when the search button is touched. Call performSegueWithIdentifier:sender: in the "activate search" action method.

rdelmar
  • 103,982
  • 12
  • 207
  • 218