我是一種新的目標c,我試圖通過引用傳遞參數,但表現得像是一個值。你知道爲什麼這不起作用嗎?按值或按引用在目標中傳遞參數C
這是函數:
- (void) checkRedColorText:(UILabel *)labelToChange {
NSComparisonResult startLaterThanEnd = [startDate compare:endDate];
if (startLaterThanEnd == NSOrderedDescending){
labelToChange.textColor = [UIColor redColor];
}
else{
labelToChange.textColor = [UIColor blackColor];
}
}
這是召喚:
UILabel *startHourLabel; // This is properly initialized in other part of the code
[self checkRedColorText:startHourLabel];
感謝您的幫助
你的意思是「表現得像是一種價值」? – 2010-05-23 16:49:05