UITableViewCell
スクロール中に私の位置が変わりましUITableView
た。ここにもっとありUITableViewCell
ます。そのため、複数のページ画面をカバーしています。上から下にスクロールすると、UITableViewCell
最初のセルが 5 番目になるように位置が変更されます。そして、2番目のセルが1番目に来ました。
私のコード:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"SignUpWithEmailCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
switch (indexPath.row) {
case 0: {
UILabel *lblFirstName = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 40)];
lblFirstName.text = @"First Name";
[cell.contentView addSubview:lblFirstName];
self.txtFirstName = [[UITextField alloc]initWithFrame:CGRectMake(lblFirstName.frame.origin.x + lblFirstName.frame.size.width + 5, 0, 190, 40)];
self.txtFirstName.delegate = self;
self.txtFirstName.text = strFirstName;
self.txtFirstName.tag = 0;
self.txtFirstName.userInteractionEnabled = YES;
self.txtFirstName.font = [UIFont systemFontOfSize:15.0];
self.txtFirstName.clearButtonMode = UITextFieldViewModeWhileEditing;
self.txtFirstName.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[cell.contentView addSubview:self.txtFirstName];
break;
} case 1: {
UILabel *lblLastName = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 40)];
lblLastName.text = @"Last Name";
[cell.contentView addSubview:lblLastName];
self.txtLastName = [[UITextField alloc]initWithFrame:CGRectMake(lblLastName.frame.origin.x + lblLastName.frame.size.width + 5, 0, 190, 40)];
self.txtLastName.backgroundColor = [UIColor clearColor];
self.txtLastName.delegate = self;
self.txtLastName.tag = 1;
self.txtLastName.text = strLastName;
self.txtFirstName.userInteractionEnabled = YES;
self.txtLastName.returnKeyType = UIReturnKeyDone;
self.txtLastName.clearButtonMode = UITextFieldViewModeWhileEditing;
self.txtLastName.font = [UIFont systemFontOfSize:15.0];
self.txtLastName.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[cell.contentView addSubview:self.txtLastName];
break;
}
default:
break;
}
}
return cell;
}
誰かがそれを正しくアーカイブするように案内してくれませんか..
前もって感謝します。