我为UI
应用设计了iOS
wAny hRegular
设置。
现在orientation
在iPad
中正常工作。但是当应用程序在iPhone
上运行时,orientation
会显示一个空白屏幕。
是否有任何方法可以仅orientation
iPhones
锁定iPad
并且describe('Login controller',function(){
beforeEach(module('app'));
var httpBackend,ctrl, scope,userService;
beforeEach(inject(function($controller, $rootScope,$httpBackend,$injector,_userService_) {
scope = $rootScope.$new();
httpBackend = $injector.get('$httpBackend');
userService = _userService_;
ctrl = $controller('LoginController', {
$scope: scope
});
}));
it('should set authentication true', function() {
scope.authenticateUser();
var username = 'test';
var password = '123456';
var requestToken = "";
httpBackend.whenGET('http://localhost:8080/services/request').respond(200,{
status : 0
});
httpBackend.expect('POST', 'http://localhost:8080/services/access').respond(200, {
status:"success"
});
var returnedPromise = userService.authenticateUser(username,password,requestToken);
httpBackend.flush();
expect(scope.result).toEqual(0);
httpBackend.verifyNoOutstandingExpectation();
httpBackend.verifyNoOutstandingRequest();
});
});
可以使用方向?
答案 0 :(得分:1)
您可以使用shouldAutorotate
和supportedInterfaceOrientation
UIViewController
方法锁定iPhone上的旋转,但不能锁定iPad上的旋转。
只需返回适用于iPad的YES
和NO
中适用于iPhone的shouldAutorotate
,然后在supportedInterfaceOrientation
中返回iPhone / iPad的允许定位。
答案 1 :(得分:0)
是@ david" mArm" Ansermot是对的,我刚刚添加了代码,以便快速捕捉: -
- (BOOL)shouldAutorotate {
UIDevice* thisDevice = [UIDevice currentDevice];
if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
return YES;
}
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
UIDevice* thisDevice = [UIDevice currentDevice];
if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
return (UIInterfaceOrientationMaskAll);
}
return (UIInterfaceOrientationMaskPortrait);
}
答案 2 :(得分:0)
您可以从项目设置中执行此操作,请查看截图
1。 http://i.imgur.com/efGrNcL.png" iPhone设置"
2。 http://i.imgur.com/I25Z2cj.png" iPad设置"