iOS 6 でアプリを作成しています。これは、ViewController.m ファイルからのコードのスニペットです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:@"CustomCellIdentifier"];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
cell = _customCell;
_customCell = nil;
}
cell.firstName.textLabel = @"dsdsds";
cell.middleName.textLabel = @"N/A";
cell.lastName.textLabel = @"daasdsdasa";
return cell;
}
次のコード行でエラーが発生します ( Property 'firstName' not found on object of type 'CustomCell*'
):
cell.firstName.textLabel = @"dsdsds";
cell.middleName.textLabel = @"N/A";
cell.lastName.textLabel = @"daasdsdasa";
CustomeCell.h:
#import <UIKit/UIKit.h>
@interface CustomCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *firstName;
@property (strong, nonatomic) IBOutlet UILabel *middleName;
@property (strong, nonatomic) IBOutlet UILabel *lastName;
+(NSString*) reuseIdentifier;
@end
In the Outlets of CustomCell.xib:
firstName -> label
middleName -> label
lastName -> label
Referencing Outlets:
customCell -> File's Owner
Selecting the firstName label:
Referencing Outlets:
firstName -> CustomCell
firstName -> CustomCell -CustomCellIdentifier
Selecting the middleName label:
lastName -> Custom Cell - CustomCellIdentifier
middleName -> Custom Cell
Selecting the lastName label:
lastName -> Custom Cell
middleName -> Custom Cell- Custom Cell Identifier
それで、問題は何ですか?私の意見では、それはアウトレットと関係があります。