這是一個讓我跌坑兩次的問題;
今天凌晨又跌了一次,因為對這樣的問題有點印象,很類似即視感,卻又感覺真的遇到過 ⋯
結果慢慢查 git log ⋯ 確實發現 ⋯ 今年二月中的時候已經跌過一次了,
記憶太遙遠,所以跌了第二次那種感覺 XDDD
不過,本回合不直接說明問題原因,要不要試著來討論看看 ?
(這是精簡問題後的內容)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------------------------------------------------------------ | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell * cell; | |
NSString * demoName; | |
cell = [tableView dequeueReusableCellWithIdentifier: @"Cell" forIndexPath: indexPath]; | |
if ( nil == cell ) { | |
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleValue1 reuseIdentifier: @"Cell"]; | |
} | |
demoName = [demoList objectAtIndex: indexPath.row]; | |
if ( nil != demoName ) { | |
[[cell textLabel] setText: demoName]; | |
} | |
switch ( ( indexPath.row % 3 ) ) { | |
case 0: { | |
[cell setBackgroundColor: [UIColor redColor]]; | |
break; | |
} | |
case 1: { | |
[cell setBackgroundColor: [UIColor greenColor]]; | |
break; | |
} | |
case 2: | |
default: { | |
[[cell textLabel] setTextColor: [UIColor blueColor]]; | |
break; | |
} | |
} | |
return cell; | |
} | |
// ------------------------------------------------------------------------------------------------ |
沒有留言:
張貼留言