UIViewController
テーブルビューとセルを追加してセットアップしました。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *identifier = nil;
NSString *task = [self.tasks objectAtIndex:indexPath.row];
NSRange urgentRange = [task rangeOfString:@"URGENT"];
if (urgentRange.location == NSNotFound) {
identifier = @"plainCell";
} else {
identifier = @"attentionCell";
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
// Configure the cell...
UILabel *cellLabel = (UILabel *)[cell viewWithTag:1];
NSMutableAttributedString *richTask = [[NSMutableAttributedString alloc]
initWithString:task];
NSDictionary *urgentAttributes =
@{NSFontAttributeName : [UIFont fontWithName:@"Courier" size:24],
NSStrokeWidthAttributeName : @3.0};
[richTask setAttributes:urgentAttributes
range:urgentRange];
cellLabel.attributedText = richTask;
return cell;
}
ストーリーボードを学習しようとしており、このサンプル コードを作成しました。私がやっている間違いがわからない、またはそれを見つけることができます。私は昨日からこれに固執しており、問題を理解することはできません。
私の学習を進めるために、あなたの助けをお願いします。
これは私が作成しようとしている例です。XCODE プロジェクトは、次の URL からダウンロードできます。
https://dl.dropboxusercontent.com/u/72451425/Simple%20Storyboard.zip
コードを調べて、前進するのを手伝ってください。