2013-01-02 1 views
2
UIDocumentInteractionController *documentController; 

-(void)openDocumentIn 

{ 

    NSString *filepath = [[NSBundle mainBundle]pathForResource:@"Learn Book" ofType:@"pdf"]; 
    NSLog(@"path:%@", filepath); 
    if(filepath == nil) 
    { 
     NSLog(@"filepath is nil."); 
     return ; 
    } 
    documentController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filepath]]; 
    documentController.delegate = self; 
    documentController.UTI = @"com.adobe.pdf"; 
    CGRect navRect = self.navigationController.navigationBar.frame; 
    navRect.size = CGSizeMake(1500.0f, 40.0f); 
    [documentController presentOpenInMenuFromRect:navRect inView:self.view animated:YES ]; 
    //[documentController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES ]; 
} 

"CGRectZero"에서 "navRect"로 변경했지만 실행 후 차이가 보이지 않습니다. 왜?presentOpenInMenuFromRect의 첫 번째 매개 변수는 무엇입니까?

답변

0

"presentOpenInMenuFromRect"의 첫 번째 매개 변수는 메뉴를 고정 할 위치 (좌표계가 보기)입니다.

높이가 & 인 직사각형을 요구하기 때문에 "CGRectZero"이 작동하지 않습니다. 그리고 네비게이션 바를 (예 : "navRect"에서했던 것과 마찬가지로) 모두 수행하는 것도 효과가 없습니다.

UIDocumentInteractionController에서 발생하는 버튼의 바로 아래 또는 옆에 사각형이 표시되도록 설정하는 것이 가장 좋습니다.

+0

반대로 CGRectZero는 일반적으로 잘 작동합니다. –

관련 문제