【问题标题】:Storyboard: Custom UITableView故事板:自定义 UITableView
【发布时间】:2012-04-09 13:05:25
【问题描述】:

我在我的项目中使用 Storyboard。

如果我使用 h.-File 我的代码将是

IImage * backgroundImage = [UIImage imageNamed:@"bg_image.png"];
UIImageView * backgroundView = [[UIImageView alloc] initWithImage:backgroundImage];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.backgroundView = backgroundView;
self.tableView.separatorColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.2];

有没有办法只在 Interface Builder 中进行这些自定义?

我猜不是。

所以我的第二个问题是,如果我使用代码,如何保留我在 Interface Builder 中制作的 Static cellsnavigation segues?仅仅省略委托方法将是无稽之谈。

那么我可以把所有东西放在一起吗?静态单元格、Navigation segues 和自定义背景?

谢谢!

【问题讨论】:

    标签: iphone ios xcode storyboard tableview


    【解决方案1】:

    嘿,我在这里发布代码希望它对你有帮助

    -(void)createTable {

    myTableView=[[UITableView alloc] initWithFrame:CGRectMake(0,132, 320, 350) style:UITableViewStylePlain];

    myTableView.delegate=self;
    myTableView.dataSource=self;
    myTableView.backgroundColor=[UIColor clearColor];
    myTableView.separatorColor=[UIColor clearColor];
    myTableView.tag=2;
    [self.view addSubview:myTableView];
    [myTableView release];
    

    } 现在只需通过 [self createTable] 调用此方法;

    【讨论】:

      猜你喜欢
      • 2013-09-14
      • 1970-01-01
      • 2012-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-19
      • 2012-02-23
      相关资源
      最近更新 更多