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

4

1 回答 1

0

创建一个从控制器(带有条形按钮的控制器)到您想要在触摸搜索按钮时继续连接的控制器的转场。在“激活搜索”操作方法中调用 performSegueWithIdentifier:sender:。

于 2015-03-09T15:52:09.213 回答