你可以以编程方式更改UITableView创建后的样式吗? [英] Can you programmatically change the style of a UITableView after it's been created?

查看:86
本文介绍了你可以以编程方式更改UITableView创建后的样式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(这是以编程方式交换现有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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆