2013-11-20 28 views
0

我的應用在iOS 5和6中工作正常。但是在iOS 7中,鍵盤顯示後模式表單不居中。這不會發生在應用程序中的另一種形式,但我沒有看到它們之間的差異。正如您在下面的圖像中看到的那樣,在第一個圖像中,它顯示爲中心,鍵盤顯示後它將移動到左側。任何想法?謝謝您的幫助。鍵盤顯示後,表單在iOS7中不居中

更新: 我使用酥料餅,以顯示它:

-(IBAction) doSignUp:(id)sender{ 
    StayInformedVC *vc = [handler getStayInformedVC:self]; //[[StayInformedVC alloc] init]; 
    popoverStayInformed = [[UIPopoverController alloc]initWithContentViewController:vc];  
    popoverStayInformed.popoverBackgroundViewClass = [BorderlessPopoverBackgroundView class]; 
    popoverStayInformed.delegate = self; 
    vc.delegate = self; 

    float width, height; 

    width = vc.contentSizeForViewInPopover.width; 
    height = vc.contentSizeForViewInPopover.height; 
    CGRect frame = CGRectMake(self.view.bounds.size.width/2 - width/2 , self.view.bounds.size.height/2, 1,1); 

    [popoverStayInformed presentPopoverFromRect:frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

    // adds a dim to the background 
    if (dimViewStayInformed == nil) { 
     dimViewStayInformed = [[UIView alloc] initWithFrame:self.view.bounds]; 
     [dimViewStayInformed setBackgroundColor:[UIColor blackColor]]; 
     [dimViewStayInformed setAlpha:0.5f]; 

    } 

    [self.view addSubview:dimViewStayInformed]; 

} 
在stayInformeddVC.m

我:

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.contentSizeForViewInPopover = CGSizeMake(popUpView.bounds.size.width, popUpView.bounds.size.height); 
} 

enter image description here

enter image description here

+0

能否請您提供一些代碼,特別是模態演示/表示的代碼和模態視圖的視圖加載代碼。 – ArtSabintsev

+0

我剛更新了這個問題。謝謝。 - –

回答

0

我剛剛發現解決方案:

我改變了這個: [popoverStayInformed presentPopoverFromRect:frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

本:

[popoverStayInformed presentPopoverFromRect:frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight animated:YES];