UITextView
を入力して情報を入力すると、情報がUITableView
に移動します。TableViewへのTextView配列
私はそれがテーブルビューに新しい行が追加されるたびに更新する必要があります。
私はTextViewの情報から配列を作成し、それをTableViewに配置できると思ったが、これを行う方法を理解できないようだ。
これでも、 'UITextView'に入力したものがテーブルに移入されません。
-(void)textViewDidChange:(UITextView *)textView{
listArray=[[NSMutableArray alloc]initWithArray:[textView.text componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]];
[self.tableView reloadData];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [listArray objectAtIndex:indexPath.row];
return cell;
}
ここにコードを記入してください。 – Khuong
問題を遅くするために簡単にコードで質問を更新してください。 –
私は質問している質問は私のプロジェクトの最初の段階です、上記のイメージは、私が配列とテキストビューを使って作った例です。 – vype