你可以以编程方式更改UITableView创建后的样式吗? [英] Can you programmatically change the style of a UITableView after it's been created?
问题描述
(这是以编程方式交换现有tableview的样式而不是以编程方式设置表视图样式)
(This is about programatically swapping the style of existing tableview and not about setting table view style programatically)
我有一种情况,我使用了分组表视图一个视图这个表是可编辑的,每当它进入可编辑视图时它就会被取代,所以我认为只要它进入编辑模式就将它的样式改为plain。
I have a situation where I used a grouped table view in a view this table is editable and whenever it goes to editable view it gets displaced so what I thought was to change its style to plain whenever it goes to editing mode.
是这可能吗? (先谢谢。)
Is this possible? (Thanks in advance.)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
MyIdentifier = [NSString stringWithFormat:@"Cell %d",indexPath.row];
// MyIdentifier =@"tblCellView";
NSString *offendersImagePath = [self applicationDocumentsDirectory];
//NSLog(@"%@", dbPath);
offendersImagePath=[offendersImagePath stringByAppendingPathComponent:@"Images"];
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
cell = aCustomCell;
aCustomCell=nil;
}
推荐答案
这不可能是$
在Apple文档中看到这是wriiten: -
No this is not possible See this is wriiten in apple documentation:-
在初始化表视图时设置表格样式(请参阅
initWithFrame:style :)。你不能以
修改之后的风格。
所以你以后不能修改它......
So you can not modify it afterwards...
这篇关于你可以以编程方式更改UITableView创建后的样式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!