2014-11-28 3 views
1

내 IOS 응용 프로그램의 일부는 UIActivityViewController가있는 파일 뷰어입니다. 그것으로부터, 나는 파일을 우편으로 보내고, 사진 (그것이 사진 인 경우)에 저장하고, 그 밖의 모든 것을 파일로 정상적인 활동보기 물건을 할 수있게하고 싶습니다. 그러나 내 응용 프로그램에는 북마크 기능이 있습니다. 사용자가이 메뉴에서 파일을 북마크 할 수있게하고 싶습니다. 책갈피 목록에 개체를 추가하기 위해 사용자 지정 UIActivity를 만들었지 만 시스템 책갈피 아이콘을 사용하는 방법을 파악할 수 없었습니다. 이것은 가능한가?책갈피 아이콘이있는 사용자 지정 UIActivity가 가능합니까?

편집 : 설명을 위해 "공유"버튼을 클릭하면 나타나는 메뉴입니다.

답변

0

쉬운 peasy. 그것은 모두 당신이 그것을 시작하는 방법, 네비게이션 컨트롤러, 스 와이프 제스처, 툴바 항목 또는 그냥 일반 버튼에 달려 있습니까? 어느 쪽이든 상관 없지만 특정 답변을 원하면 특정 질문을해야합니다.

-(IBAction) moreActions:(id)sender { 
UIActionSheet *moreActions = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Add To Favorites", @"Download For Offline View",@"Open Document In :", nil]; 
[moreActions showInView:self.view]; 
} 
: 여기

는 addToFav 및 다운로드, 당신의 목표는 스토리 보드 인터페이스에 연결되어있는 북마크 버튼을 사용하여 구매하는 인터페이스를 그러나 IBActions을하지 않는 수행 할 필요가 없습니다 방법 예입니다

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 

switch (buttonIndex) { 
    case 0: [self addToFav:self]; //See IBAction below 
     break; 
    case 1: [self download:self]; //See IBAction below 
     break; 
    case 2: { 
     //UIDocumentInteractionController: 

     NSURL *docURL = [NSURL URLWithString:@"filePathStringHere"]; 

     documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:docURL]; 
     [documentInteractionController setDelegate:self]; 
     [documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]; 
    } 
     break; 
} 

}

- (IBAction)download:(id)sender { 
//enter your download code here 
} 

- (IBAction)addToFav:(id)sender { 
//Code to add to your favorites 
} 
: 당신이 작업을 수행

그리고 그 방법은 아래의 메소드를 호출하는 것입니다