2011-06-02 95 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个部分。