这是一个屏幕截图,显示我所描述的内容:
以及相关代码:
- (NSInteger)spreadView:(MDSpreadView *)aSpreadView numberOfColumnsInSection:(NSInteger)section{
return self.viewModel.matrix.width - 1;
}
- (NSInteger)spreadView:(MDSpreadView *)aSpreadView numberOfRowsInSection:(NSInteger)section{
return self.viewModel.matrix.height - 1;
}
-(MDSpreadViewCell *)spreadView:(MDSpreadView *)aSpreadView cellForRowAtIndexPath:(MDIndexPath *)rowPath forColumnAtIndexPath:(MDIndexPath *)columnPath{
MDSpreadViewCell *cell = [aSpreadView dequeueReusableCellWithIdentifier:@"InfoCell"];
if (cell == nil){
cell = [[[MDSpreadViewCell alloc] initWithStyle:MDSpreadViewCellStyleDefault reuseIdentifier:@"InfoCell"] autorelease];
}
cell.textLabel.text = ((DTVendor *)self.vendors[rowPath.row]).name;
return cell;
}
-(CGFloat)spreadView:(MDSpreadView *)aSpreadView heightForRowHeaderInSection:(NSInteger)rowSection{
return 200;
}
-(CGFloat)spreadView:(MDSpreadView *)aSpreadView widthForColumnHeaderInSection:(NSInteger)columnSection{
return 200;
}
-(CGFloat)spreadView:(MDSpreadView *)aSpreadView heightForRowAtIndexPath:(MDIndexPath *)indexPath{
return 200;
}
-(CGFloat)spreadView:(MDSpreadView *)aSpreadView widthForColumnAtIndexPath:(MDIndexPath *)indexPath{
return 200;
}
-(id)spreadView:(MDSpreadView *)aSpreadView titleForHeaderInColumnSection:(NSInteger)section forRowAtIndexPath:(MDIndexPath *)rowPath{
return ((DTVendor *)self.vendors[rowPath.row]).name;
}
-(id)spreadView:(MDSpreadView *)aSpreadView titleForHeaderInRowSection:(NSInteger)section forColumnAtIndexPath:(MDIndexPath *)columnPath{
return ((DTVendor *)self.vehicleClasses[columnPath.column]).name;
}
MDScrollView 正在截断列标题标签,我不知道为什么。