2010-05-25 7 views

Répondre

1

Vous pouvez remplir le UIScrollView en utilisant quelque chose comme ceci:

// NSArray *strings; 
// UIScrollView *scrollView; 
// NSMutableArray *textFields; 

self.textFields = [NSMutableArray array]; 

const CGFloat width = 320; 
const CGFloat height = 31; 
const CGFloat margin = 0; 
CGFloat y = 0; 

for(NSString *string in strings) { 
    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, y, width, height)]; 
    textField.delegate = self; 
    textField.text = string; 

    [scrollView addSubview:textField]; 
    [textFields addObject:textField]; 
    [textField release]; 

    y += height + margin; 
} 

scrollView.contentSize = CGSizeMake(width, y - margin); 

et de gérer le changement des cordes dans les méthodes UITextFieldDelegate.

Questions connexes