我試圖做數組元素的行動,但我真的不明白,爲什麼我的代碼不工作:目標C,數組操作
這裏是我的.h:
@interface ViewController : UIViewController
{
NSArray *tableauScore;
UILabel * modificationScore;
}
@property (weak, nonatomic) IBOutlet UILabel *nom1;
@property (weak, nonatomic) IBOutlet UILabel *nom2;
@property (weak, nonatomic) IBOutlet UILabel *nom3;
@property (weak, nonatomic) IBOutlet UILabel *nom4;
@property (weak, nonatomic) IBOutlet UILabel *bsc1;
@property (weak, nonatomic) IBOutlet UILabel *bsc2;
@property (weak, nonatomic) IBOutlet UILabel *bsc3;
@property (weak, nonatomic) IBOutlet UILabel *bsc4;
@end
我.m:
tableauScore = [NSArray arrayWithObjects:nom4, nom3, nom2, nom1, bsc1, bsc2, bsc3, bsc4, nil];
for(int i = 0; i < 8; i++)
{
modificationScore = [tableauScore objectAtIndex:i];
modificationScore.hidden = NO;
modificationScore.center = CGPointMake(modificationScore.center.x, modificationScore.center.y -40);
}
問題是我有一個線程點在「modificationScore = [tableauScore objectAtIndex:i];」線路,我不知道爲什麼。我看到很多話題,但沒有人能幫助我。你有沒有想法?
謝謝!
謝謝你羅蘭,它完美的作品! – alex777771
歡迎您:) –