2011-09-01 52 views

回答

0

可以將此視圖添加到細胞你想:

UITableViewCell *cell = [self tableView:self.tableView cellForRowAtIndexPath:indexPathOfCell]; 
[cell addSubview:view]; 
+0

你沒有明白我的觀點。如果像你說的那樣做,每個單元格將顯示相同的加載視圖,這也會影響原始顯示。 – forest

0

最簡單的方法來添加加載視圖會是這樣

// get the frame of your table header view 
CGRect headerFrame = headerView.frame; 

// construct a frame that is the screen minus the space for your header 
CGRect loadingFrame = [[UIScreen mainScreen] applicationFrame]; 
loadingFrame.origin.y += headerFrame.size.height; 
loadingFrame.size.height -= headerFrame.size.height; 

// use that frame to create your loading view 
MyLoadingView *loadingView = [[MyLoadingView alloc] initWithFrame:loadingFrame]; 

// add your view to the window * 
[[headerView window] addSubview:loadingView]; 

*添加視圖到窗口可能不對你的設計來說是最好的事情,但是因爲我不知道你的視圖層次結構的任何細節,所以這種方式總是能夠工作。


注意:如果你不掩飾分段控制,並已啓用,用戶可以點擊它,並改變應用程序的狀態時,你是不是期待它 - 當你喜歡試圖爲他們加載一些東西。如果用戶更改應用程序的狀態,請確保您可以取消此加載視圖。

+0

我的看法是一個可用視圖,頂部有一個導航欄。你可以修復它爲我的視圖層次。 – forest

+0

這實際上並不是我正在談論的細節層次:)我敢肯定,如果您嘗試用您自己的某些視圖代替'[headerView窗口]',您將能夠弄清楚它的漂亮程度快。 –

相關問題