第三章小感:
Messages sent to the delegate object of a table view carry a parameter that tells thedelegate object which table view has fired that message in its delegate. This is veryimportant to make note of because you might, under certain circumstances, requiremore than one table view to be placed on one object (usually a view). Because of this,it is highly recommended that you make your decisions based on which table view hasactually sent that specific message to your delegate object, like so:
- (CGFloat) tableView:(UITableView *)tableViewheightForRowAtIndexPath:(NSIndexPath *)indexPath{
CGFloat result = 20.0f;
if ([tableView isEqual:self.myTableView]){
result = 40.0f;}
return result;}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* result = nil;
static NSString *MyCellIdentifier = @"SimpleCells";
result = [tableView dequeueReusableCellWithIdentifier:MyCellIdentifier];
if (result == nil){
result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyCellIdentifier];
}
result.textLabel.text = [NSString stringWithFormat:@"Section %ld, Cell %ld",
(long)indexPath.section, (long)indexPath.row];
result.indentationLevel = indexPath.row; result.indentationWidth = 10.0f;
return result; }
看了这个觉得纳闷,我记得之前是用一个委托来做的啊,翻阅了一下,委托,发现都是叫indentationLevel,哦,就当时两个方法都可以实现这个功能吧。
嗯,还有一点是,After this property is set, Cocoa Touch will ignore the value of the accessoryType property and will use the view assigned to the accessory View property as the accessory assigned to the cell.。
也就是说,Cocoa Touch 会忽略accessoryType这个熟悉,如果用了accessory View 这个熟悉。
the table viewwill notice this move and will then shift Section B to the previous position of SectionA and will move Section B to the previous position of Section B.
这里有笔误。哈哈,应该把c放到先前b的地方
看完第三章了,啊哈哈。