2011-11-24 57 views
0

我如何處理UIActionSheet和three20?我是this教程。我該如何處理UIActionSheet和Three20?

我知道通過點擊縮略圖查看器中的一個來顯示單張照片是由Three20免費提供給您的。此外,圖書館還提供所有原生功能,如捏縮放,滑動導航和點擊以隱藏/顯示導航箭頭和後退按鈕。

我想添加一個按鈕,如果用戶點擊,將顯示帶有選項UIActionSheet分享通過郵件或彩信照片並保存(使用UIImageWriteToSavedPhotosAlbum)和用戶會選擇其中的一種。

我看到很多關於這個的教程,但我需要我自己做這個。

回答

0
在.h文件中

在.m文件添加

UIActionSheet *actionViewPopup; 

actionViewPopup = [[UIActionSheet alloc] initWithTitle:nil 
                delegate:self 
             cancelButtonTitle:@"Cancel" 
            destructiveButtonTitle:nil 
             otherButtonTitles:@"email",@"sms",nil]; 

[actionViewPopup showInView:self.parentViewController.tabBarController.view]; 

CODE FOR ACTIONSHEET

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
    //THIS METHOD SHOWS WHICH BUTTON FROM ACTION SHEET IS PRESSED 
    if (buttonIndex == 0) 
    { 
     NSLog(@"email clicked"); 
     //do code for email (mail composer) 

    } 
    if (buttonIndex == 1) 
    { 
     NSLog(@"sms clicked"); 
     //do code for sms 

    } 

} 
+0

確定的處理手法,但我想在一個單一的照片添加按鈕查看怎麼做到這一點?單張照片視圖是由three20創建的ordy什麼是單張照片視圖thx – rain

+0

謝謝你的幫助 – rain