如何控制iPad/iPhone横向和竖向分析
发布时间:2021-11-23 16:10:10 所属栏目:教程 来源:互联网
导读:对于刚接触ipad/iPhone编程的人来说,控制其显示方向是挺纠结的!下面我来给大家详细讲讲这应该是如何控制的。 相信很多人都是,我要控制其横向显示不是很简单,直接在代码里的 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)inte
对于刚接触ipad/iPhone编程的人来说,控制其显示方向是挺纠结的!下面我来给大家详细讲讲这应该是如何控制的。 相信很多人都是,我要控制其横向显示不是很简单,直接在代码里的 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 函数里控制其显示方向不就行了?并且网上也有很多这方面的教程也是这么说的! 那好,那么我们新建一个工程,在其AppDelegate.m里添加下面的代码 控制横向【在网上搜索,相信大家都能得到如何代码控制其横向显示效果的代码】 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) { return YES; } else { return NO; } } (编辑:济南站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |