Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikezang

macrumors 6502a
Original poster
May 22, 2010
939
41
Tokyo, Japan
I have a table view with more than ten cells in row, it is not easy to set data as below
Code:
//  CustomCell.h
#import <UIKit/UIKit.h>
@interface CustomCell : UITableViewCell {
	UILabel *labelStartDate;
	UILabel *labelEndDate;
	UILabel *labelTradeType;
	UILabel *labelAccount;
	UILabel *labelCode;
	UILabel *labelName;
	UILabel *labelAmount;
	UILabel *labelStartPrice;
	UILabel *labelEndPrice;
	UILabel *labelValue;
	UILabel *labelProfitLoss;
	UILabel *labelProfitLossRate;
}
@property (nonatomic, retain) IBOutlet UILabel *labelStartDate;
@property (nonatomic, retain) IBOutlet UILabel *labelEndDate;
@property (nonatomic, retain) IBOutlet UILabel *labelTradeType;
@property (nonatomic, retain) IBOutlet UILabel *labelAccount;
@property (nonatomic, retain) IBOutlet UILabel *labelCode;
@property (nonatomic, retain) IBOutlet UILabel *labelName;
@property (nonatomic, retain) IBOutlet UILabel *labelAmount;
@property (nonatomic, retain) IBOutlet UILabel *labelStartPrice;
@property (nonatomic, retain) IBOutlet UILabel *labelEndPrice;
@property (nonatomic, retain) IBOutlet UILabel *labelValue;
@property (nonatomic, retain) IBOutlet UILabel *labelProfitLoss;
@property (nonatomic, retain) IBOutlet UILabel *labelProfitLossRate;
@end

Can I use as below?
Code:
//  CustomCell.h
#import <UIKit/UIKit.h>
@interface CustomCell : UITableViewCell {
	UILabel *label[10];
}
@property (nonatomic, retain) IBOutlet UILabel *label[10];
@end
 
No that won't work. Amusing idea though.

You could set tags for these views in IB and recover the labels with viewWithTag: if you find that more convenient.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.