私は iOS アプリに取り組んでおり、テキスト ラベルを 2 行にしたいと考えています。次のコードを見つけましたが、動作していないようです。私が間違っていることについてのアイデアはありますか?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
[[cell textLabel] setNumberOfLines:2];
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:10.0];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
//Configure cell
}