ios UI設計與開發 彈出式視圖

來源:互聯網
上載者:User

1.Alert View 一般給使用者提供警示資訊。

 如: 

 

UIAlertView *alert =[[UIAlertView alloc] initWithTitle:nil message:@"相機不能用" delegate:nil cancelButtonTitle:@"關閉" otherButtonTitles:nil];
        [alert show];
        [alert release];

 

2.Action Sheets用來提示使用者在可能的幾種操縱中作出選擇,也可以用來在使用者將要進行無法復原的危險操作時,給使用者確認或取消的機會。

 

    建立Action Sheets 需要3個步驟:

1.指定相應的ViewController遵循UIActionSheetDelegate協議

2.實現相應的delegation方法

3.建立並顯示Action Sheet是給使用者選項,所以按鈕數目肯定要大於一個。另外,按鈕上顯示的文字應該能夠明確標識按鈕的功能。 

 

- (IBAction)loadActionSheet:(id)sender 
{
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Action Sheet視窗" 
                                                             delegate:self 
                                                    cancelButtonTitle:@"關閉" 
                                               destructiveButtonTitle:nil 
                                                    otherButtonTitles:@"顯示Alert視窗", 
                                  @"do sth", @"do sth", nil];
    
    [actionSheet showInView:self.view];
    [actionSheet release];
}
//UIActionSheetDelegate協議的方法
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    switch (buttonIndex)
    {
        case 0:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"alert視窗" 
                                                            message:@"內容 btn1" 
                                                           delegate:self 
                                                  cancelButtonTitle:@"確認"
                                                  otherButtonTitles:nil];
            [alert show];
            [alert release];
        }
            break;
        case 1:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"alert視窗" 
                                                            message:@"內容 btn2" 
                                                           delegate:self 
                                                  cancelButtonTitle:@"確認"
                                                  otherButtonTitles:nil];
            [alert show];
            [alert release];
        }
            break;
        case 2:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"alert視窗" 
                                                            message:@"內容 btn3" 
                                                           delegate:self 
                                                  cancelButtonTitle:@"確認"
                                                  otherButtonTitles:nil];
            [alert show];
            [alert release];
        }
            break;
        case 3:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"關閉alert視窗" 
                                                            message:@"內容 關閉" 
                                                           delegate:self 
                                                  cancelButtonTitle:@"確認"
                                                  otherButtonTitles:nil];
            [alert show];
            [alert release];
        }
            break;
            
        default:
            break;
    }

 

3.Modal Views 是彈出的相對獨立的使用者介面,在這個介面中使用者可以完成一些相對獨立於軟體的事物,完成後可以退出Modal View返回軟體介面。比較典型的例子包括在軟體中發送郵件、從相片庫中選取照片等。 

     設計使用Mdal View的時候需要注意幾點:首先Modal View一般都是全屏,其次Modal View應該提供明確的讓使用者退出Modal View的按鈕,一般做法是在上面顯示導航條。 

       [self presentModalViewController:picker animated:YES];

    Modal View 樣本參照:http://www.cnblogs.com/hanjun/archive/2012/11/22/2783266.html 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.