2013-06-18 32 views
0

我正在做一個項目,我必須展示一個像這樣的視圖,我試圖使用表視圖,但我無法實現,之後,我決定實現這與集合view.but的幫助,但沒有發生富有成果。我在這裏感到沮喪,因爲我的觀點沒有什麼可以發生。這些是在視圖上添加的文本字段,並且都是可點擊的,任何人都可以幫助我,因爲我是新鮮人,所以請幫助我。如何在uicollection視圖中添加文本框?

enter image description here

+0

我認爲這是可以用分組的tableView的幫助下完成的。檢查文檔http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/tableview_iphone/tableviewstyles/tableviewcharacteristics.html – iCoder

+0

這可以通過使用tableview來定製它的單元格。 –

+0

@Norbert @Norbert我試過它的表視圖的幫助,但無法實現。請建議我一些其他方式 – Priyanka

回答

0
////////////////// 
    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
    { 
     if(section==0) 
     { 
      return self.view_header; 
     } 

     return nil; 
    } 

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 
    { 
     CGFloat height =0.00; 

     if(section==0) 
     { 
      height = 32; 
     }  

     return height; 
    } 

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

     if(indexPath.section == 1) 
     { 
      return 51; 
     } 
     else 
     { 
      return 35; 
     } 
    } 



    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 

     if(self.flag_loadCompleted == TRUE) 
     { 
      return 1; 
     } 
     return 2; 
    } 


    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 

     if(section == 0) 
     { 
      return [self.arr_data count]; 
     } 
     else if(section == 1) 
     { 
      return 1; 
     } 

     return 0; 
    } 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {  

    static NSString *CellIdentifier = @"MyTemplate"; 
    MyFinancialTemplate *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if(cell == nil) 
    { 
     cell = [MyFinancialTemplate createNewTextCellFromNib]; 
    }  
    cell.index = indexPath.row; 
    if(indexPath.section == 0) 
    { 
     cell.index = indexPath.row; 
     cell.flag_loader = FALSE; 

     cell.selectionStyle = UITableViewCellSelectionStyleGray; 
    } 
    else 
    { 
     cell.selectionStyle = UITableViewCellSelectionStyleNone; 
     cell.flag_loader = TRUE; 
    } 

    [cell LoadCell]; 

    return cell; 
} 


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

} 
+0

好吧,我會嘗試這個。感謝您的幫助,並請告訴我如何得到每個文本域的響應。 – Priyanka

+0

使用文本字段的代表 –

相關問題