我手动调用segue(设置为模态),以便使用具有以下代码行的Storyboard在Xcode 4.2中显示登录表单:
[self performSegueWithIdentifier:@"LoginSegue" sender:nil];
我可能遗漏了一些非常简单的东西,但我找不到以编程方式关闭登录视图并返回上一个视图的方法。
视图是导航视图控制器的一部分,因此将segue类型设置为“push”允许我使用后退按钮将我发送回我之前的屏幕,但在“模态”模式下,我并非完全确定如何实现这一点(例如按下按钮后)
非常感谢任何帮助。
答案 0 :(得分:172)
如果您的部署目标是iOS 5.0或更高版本,请使用以下消息:
[self dismissViewControllerAnimated:YES completion:nil];
或者在Swift中:
self.dismissViewControllerAnimated(true, completion: nil)
如果您的部署目标较旧,请使用此(已弃用)消息:
[self dismissModalViewControllerAnimated:YES];
答案 1 :(得分:13)
[self dismissViewControllerAnimated:YES completion:nil];
是IOS5中的一种新方法
答案 2 :(得分:5)
以下应该可以正常工作......
[self dismissModalViewControllerAnimated:YES];
我使用latest tutorial here中的登录页面完成此操作,没有任何问题。
答案 3 :(得分:4)
以下代码适用于swift 3:
<asp:Chart ID="Chart4" runat="server" BackColor="DarkSlateBlue" BackGradientStyle="LeftRight"
BorderlineWidth="0" Height="440px" Palette="SeaGreen" PaletteCustomColors="24, 0, 0"
Width="560px" BorderlineColor="128, 128, 255" OnLoad="Chart4_Load">
<Titles>
<asp:Title Name="DefaultTitle" Font="Trebuchet MS, 15pt, style=Bold"
Text = "Overall Scoring Progress" />
</Titles>
<%-- <Legends>
<asp:Legend Name="DefaultLegend" Enabled="True" Docking="Top" />
</Legends>--%>
<Series>
<asp:Series Name="Series1" IsValueShownAsLabel="true" YValuesPerPoint="10" ChartType="Pie"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea4" >
</asp:ChartArea>
</ChartAreas>
</asp:Chart>