2012-02-08 68 views
0

我遇到了UITableView行選擇問題, 在視圖加載(根據配置)我調整TableView 50px的大小,在這種情況下點擊和選擇不能在這50個像素。當調整大小時Xcode UITableView選擇不起作用

if (Config.alza){ 
    //Se non ho nessuno sconto incremento la dimensione della lista di 50Px necessari per mostrare gli sconti testata 
    CGRect frame = ListaOrdine.frame; 
    frame.size.height += 50; 
    ListaOrdine.frame = frame; 
} 

//Attivo la gestione del click 
TapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(Click:)]; 
[TapGesture setNumberOfTapsRequired:1]; 
[TapGesture setCancelsTouchesInView:NO]; //Serve per non bruciare l'evento click 
[ListaOrdine addGestureRecognizer:TapGesture]; 

有人有什麼想法嗎?

回答

0

您需要使用表視圖委託指定行的高度

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 

    //Your existing code 
    if (Config.alza){ 
     //Se non ho nessuno sconto incremento la dimensione della lista di 50Px necessari per mostrare gli sconti testata 
     return yourDefaultCellHeight + 50; 
    } 

    return yourDefaultCellHeight; 

} 
+0

我不能提高行的高度。我想使用整個屏幕(因爲我會隱藏其他控制不必要的) – Tommaso 2012-02-08 17:24:23

0

實現此方法- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

+0

我已經實現了didselectrowatindexpath,但事件不會觸發該50px – Tommaso 2012-02-08 17:19:50

+0

你實現 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath :(NSIndexPath *)indexPath方法?? – 2012-02-08 17:23:37

+0

是的,我已經實現了所有委託方法 – Tommaso 2012-02-08 17:26:45

0

我已經bringtofront的tableview控制解決調整後

if (Config.alza){ 
    //Se non ho nessuno sconto incremento la dimensione della lista di 50Px necessari per mostrare gli sconti testata 
    CGRect frame = ListaOrdine.frame; 
    frame.size.height += 50; 
    ListaOrdine.frame = frame; 
    [self.view bringSubviewToFront:ListaOrdine]; 
} 

問題似乎是,更新的50px的tableview被另一個視圖觸發,而不是tableview發生的事件