2010-10-05 79 views

回答

2

沒有任何內置視圖可以提供該功能。這意味着將會有相當多的工作來複制該功能。

什麼你可以嘗試是:

1)用筆尖創建一個新的UIViewController

2)添加的頂杆和UIScrollView與不透明= NO和alpha = 0

3)如果有的「模板」,他們可以直接在筆尖加入固定數量。你應該可以使用UIImageView

4)否則,你可以在例如動態地添加「模板」。 viewDidLoad。唯一可能有點棘手的部分是計算幀。下面的僞代碼應該讓你開始。

int MARGIN = 20; 
float templateWidth = self.scrollView.bounds.size.width/3; 
float templateHeight = 300; 

for (int i = 0; i < [templates count]; i++) { 
    int row = i/3; 
    int col = i % 3; 

    float x = MARGIN + col * templateWidth; 
    float y = MARGIN + row * templateHeight; 
    CGRect templateFrame = CGRectMake(x, y, width - 2 * MARGIN, height - 2 * MARGIN); 

    // initialize `UIImageView` or similar 

    templateView.frame = templateFrame; 
    [self.scrollView addSubView:templateView]; 
} 

self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.width, /* max bottom of templates */); 
} 

完成版面設計後,其餘部分應該很簡單,因爲您只需響應模板圖像上的水龍頭即可。看看UITapGestureRecognizer就可以做到這一點。

關於iPhone。我可能會按照您在iWorks應用程序中選擇文檔的方式進行操作。此時只有一個模板顯示在屏幕上,而您左右滑動以選擇。但這一切都取決於上下文。也許桌面視圖更適合iPhone。

祝你好運!

2

使用iOS 6,請使用UICollectionView!