2012-02-08 34 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发生的事件