2011-06-02 98 views

回答

1

是否所有的這在用的UITableViewController -

UITableViewDelegate, UIPickerViewDelegate, UITableViewDataSource, UIPickerViewDataSource - 

對於病人& ACC =>設定的UITextField作爲一個子視圖(執行此操作在的cellForRowAtIndexPath爲各自的行)

出生和Date =>分別使用UIDatePickerView和行== 2和行== 4。

For Modality =>我不知道你是什麼意思;但你需要做類似的事情

爲了獲得其他兩個值的另一部分;返回節= 2

(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 

,併爲那些相應設置標題(如果需要)

代碼:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
static NSString *CellIdentifier = @"Cell"; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; 
    UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(110, 10, 185, 30)]; 

    textField.clearsOnBeginEditing = YES; 
    textField.textAlignment = UITextAlignmentRight; 
    textField.returnKeyType = UIReturnKeyDone; 
    textField.delegate = self; 
    [cell.contentView addSubview:textField]; 

    if (indexPath.row == 2) 
    { 
     UIDatePicker *datePicker = [[UIDatePicker alloc] init]; 
     datePicker.datePickerMode = UIDatePickerModeDate; 
     [datePicker addTarget:self action:@selector(datePickerValueChangedd:) forControlEvents:UIControlEventValueChanged]; 
     datePicker.tag = indexPath.row; 
     textField.inputView = datePicker; 

     NSDateFormatter *df = [[NSDateFormatter alloc] init]; 
     df.dateStyle = NSDateFormatterMediumStyle; 
     NSString *local; 
     local = [self datePickerValueChangedd: datePicker]; 
     NSLog(@"%@", local); 
     textField.text =local; 
     [datePicker reloadInputViews]; 
     [datePicker release]; 

    } 
} 

// Configure the cell... 

NSInteger row = [indexPath row]; 
cell.textLabel.text = [doseInfoDetailsArray objectAtIndex:row]; 

return cell; 

}

+0

ü可以給我說 – AMH 2011-06-02 14:01:09

+0

見代碼示例代碼以上並相應地使用它 – Legolas 2011-06-02 14:04:09

+0

所以......它有用嗎?我還有一個建議。在textFieldDidBeginEditing中使用datePicker方法。您可以使用PickerView中的值設置日期。 – Legolas 2011-06-02 15:05:25

0


你可以採取的UITableView與風格的自定義的UITableView 「組」可以有3個部分。