在我的willAnimateRotationToInterfaceOrientation
方法中,我有以下内容:
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
if (IS_IPHONE_5) {
_headerImage.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.height, 50);
NSURLRequest *_request = [NSURLRequest requestWithURL:[NSURL URLWithString:[Shared LogoLandPhoneRet]]];
[_headerImage setImageWithURLRequest:_request andDefaultImageName:nil andUserData:nil target:self sucessful:nil failed:nil];
} else {
_headerImage.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.height, 50);
NSURLRequest *_request = [NSURLRequest requestWithURL:[NSURL URLWithString:[Shared LogoLandPhone]]];
[_headerImage setImageWithURLRequest:_request andDefaultImageName:nil andUserData:nil target:self sucessful:nil failed:nil];
}
} else {
if (IS_IPHONE_5) {
_headerImage.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 50);
NSURLRequest *_request = [NSURLRequest requestWithURL:[NSURL URLWithString:[Shared LogoPortPhoneRet]]];
[_headerImage setImageWithURLRequest:_request andDefaultImageName:nil andUserData:nil target:self sucessful:nil failed:nil];
} else {
_headerImage.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 50);
NSURLRequest *_request = [NSURLRequest requestWithURL:[NSURL URLWithString:[Shared LogoPortPhone]]];
[_headerImage setImageWithURLRequest:_request andDefaultImageName:nil andUserData:nil target:self sucessful:nil failed:nil];
}
}
// [NSThread detachNewThreadSelector:@selector(doTable) toTarget:self withObject:NULL];
[_feedTable reloadData];
}
然而,当我现在旋转我的设备时,它会滞后并需要大约2-3秒来实际旋转。关于为什么会出现这种情况的任何建议?
答案 0 :(得分:0)
它滞后还是冻结界面?我的猜测是请求冻结了界面,所以你应该尝试使请求异步或尝试在之前进行缓存..