可以通过UISplitViewController
在iPhone上从主控制器返回到详细控制器吗?我尝试使用displayMode
将PrimaryHidden
更改为showDetailViewController
,splitViewController?.viewControllers[0]
使用def set_conversation
@user = User.find(params[:id]) if @user?
if Task.between(current_user.id, @user.id).present?
#### QUESTION: What will happen if there's no Conversation betwwen the current user
#### and the user? What is the returning value of this method? Should you
#### redirect it again to user_profile path?
if Conversation.between(current_user.id, @user.id).present?
@conversation = Conversation.between(current_user.id, @user.id).first
@reciever = interlocutor(@conversation)
@messages = @conversation.messages
@message = Message.new
@uploader = @message.mfile
@uploader.success_action_redirect = messagefilecreation_conversation_url(@conversation.id)
end
else
redirect_to user_profile_path(@user)
end
end
,但没有任何内容能够显示细节控制器。
我希望两个控制器都没有解除和重新加载,因为一个包含地图和第二个地图对象的首选项。
答案 0 :(得分:0)
假设您在主视图中有一个按钮,按下该按钮将带您进入详细视图。这是一个如何实现的例子
@IBAction func buttonToGoToDetailView(sender: UIButton) {
performSegueWithIdentifier("segue id in storyboard", sender: nil)
}
// prpare for segua to detail view
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let destination = segue.destinationViewController as? UIViewController
if let dvc = destination as? NameOfTheDetailViewController{
if segue.identifier = "segue id in storyboard" {
//use dvc to pass data to the detail if there is any
}
}
}