2012-04-15 24 views
1

我有一個函數,我之前編寫過從條形按鈕項呈現彈出式窗口,現在我試圖重用它來顯示錶格處於編輯模式。iOS獲取UITableViewCellAccessoryDe​​tail的視圖

我已經試過

[self showPopover:[[theTableView cellForRowAtIndexPath:indexPath] editingAccessoryView]] 

但這是NULL。

最初它與[cell setEditingAccessoryType: UITableViewCellAccessoryDetailDisclosureButton];設置,如果這有什麼區別。

而且酥料餅的功能是

-(void) showPopover:(id)sender { 
    ... 
    [self.popOver presentPopoverFromBarButtonItem:sender 
          permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
} 

任何想法,請。

回答

0

如何試圖顯示與:

- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated 

只是通過它你cell.accessoryView.frame的「矩形」的說法。

+0

我想保持功能完全一樣,它使用了很多,我不想經過和編輯它的每一次出現,我認爲這是你建議的做法。在最壞的情況下,我可以使用currentpopoverfromrect來寫一個新的,只是儘可能地重用。 – Josh 2012-04-15 15:49:03

+1

複製代碼回來咬你到底:) – Stavash 2012-04-15 15:51:24

+0

我的意思是我已經使用了很多功能,只有它的一個版本。但是我不需要在任何地方編輯它來傳遞不同的參數嗎?也許我不清楚,它是'[[TableView cellForRowAtIndexPath:indexPath] editingAccessoryView]'這是NULL – Josh 2012-04-15 15:53:39