1.使用
//跳转到聊天视图
self.performSegueWithIdentifier("toChatSegue",
sender:
self)
再在prepareForSegue中进行场景过渡前准备
override
func prepareForSegue(segue:
UIStoryboardSegue, sender:
AnyObject!) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
// 判断是否转到聊天界面
if ( segue.identifier == "toChatSegue" ) {
//取聊天视图的控制器
let dest = segue.destinationViewController as! ChatViewController
//把当前选择单元格的用户名传递给聊天视图
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
// 判断是否转到聊天界面
if ( segue.identifier == "toChatSegue" ) {
//取聊天视图的控制器
let dest = segue.destinationViewController as! ChatViewController
//把当前选择单元格的用户名传递给聊天视图
dest.toBuddyName
=
currentBuddyName
}
}
2.使用SB回退过渡
自己建一个@IBAction
func XXXXX(segue:
UIStoryboardSegue)函数
在SB中连线到上面的导航窗退出按钮。
@IBAction
func unwindToBList(segue:
UIStoryboardSegue) {
//如果是登陆界面的完成按钮点击了, 开始登陆
let source = segue.sourceViewController as! LoginViewController
if source.requireLogin {
}
//如果是登陆界面的完成按钮点击了, 开始登陆
let source = segue.sourceViewController as! LoginViewController
if source.requireLogin {
}
当然要在回退的界面先做场景过渡的准备
prepareForSegue
if sender as NsObject == self.doneButton
{
NSUserDefaults.standardUserDefaults().setObject(userTF.text,forkey:”weixinid”)
}
}