0
在我的應用程序需要將文本粘貼到一個UITextView
並查看它的行中的一個UITableView
行,但是我所遇到的地方,當我粘貼應用中的文本它創建一個額外的未使用的一個不尋常的問題行並移動到文本下方的行中。 。在圖像中,您可以看到我在TextView的頂部輸入了文本,並且每次向下移動時都會創建一個空行。粘貼文本創建額外的空間
繼承人我的代碼。
-(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 = [NSString stringWithFormat:@"%@",[listArray objectAtIndex:indexPath.row]];;
return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [listArray count];
}
-(void)textViewDidChange:(UITextView *)textView{
listArray=[[NSMutableArray alloc]initWithArray:[textView.text componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]];
[self.tableView reloadData];
}
這不會發生的一切我貼,但確實發生了根本的一個主要的一段文字,我需要進入應用程序。
我只是得到了最終的文本中未使用變量警告刪除多餘的空間。 – vype
,因爲你沒有在任何地方使用這個變量 – Jamil
即使當我將它改變爲textView時它仍然不會改變。 – vype