hi我又來提問了。
我的問題是我想知道怎麼樣能實現for循環中int的屬性修改?
例子:
controller.h:
@property (weak, nonatomic) IBOutlet UILabel *lblTeamName1;
@property (weak, nonatomic) IBOutlet UILabel *lblTeamName2;
@property (weak, nonatomic) IBOutlet UILabel *lblTeamName3;
controller.m
@synthesize property lblTeamName1;
@synthesize property lblTeamName2;
@synthesize property lblTeamName3;
for(int i = 0;i <= 3;i++)
{
lblTeamName(i).text = @"something";
}
不知道這樣能不能實現哦?
for (int i=1; i<4; i++) {
UILabel *label = [self objectForKey:[NSString stringWithFormat:@"lblTeamName%i", i]];
label.text = @"blah";
}