我在appdelegate类的窗口中添加了一个viewcontroller,如下所示:
-(void)showSearchView:(BOOL)view
{
if(view)
{
searchViewController = [[SearchView alloc] initWithNibName:@"SearchView" bundle:nil];
CGRect viewFrame=searchViewController.view.frame;
viewFrame.origin.y=-1024;
viewFrame.origin.x=248;
[window addSubview:searchViewController.view];
searchViewController.view.frame = viewFrame;
[UIView beginAnimations:@"UIBase Hidden" context:nil];
[UIView setAnimationDuration:0.5];
searchViewController.view.transform = CGAffineTransformMakeTranslation(0,1024);
[UIView commitAnimations];
}
else
{
[UIView beginAnimations:@"UIBase Shown" context:nil];
[UIView setAnimationDuration:0.5];
searchViewController.view.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
[self performSelector:@selector(doTHis) withObject:nil afterDelay:1];
}
}
通过此命令从其他类调用此方法 [apd showSearchView:YES]; 其中apd是appdelegate类的对象
一切正常,直到这里,但是当我尝试旋转它不会旋转。我甚至在以下方法中返回YES,但仍然没有旋转:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
应该做什么?
答案 0 :(得分:0)
请记住,UIWindow不会旋转。也许您应该添加一个基本视图控制器并进行轮换。