【问题标题】:How Reduce the Width of ContentSize in UITableViewCellUITableViewCell中如何减小ContentSize的宽度
【发布时间】:2015-05-12 05:56:49
【问题描述】:

如何减小contentSize的大小UITableViewCell的宽度。

-> 我在UITableView 属性中尝试过,但有一些选项可以减少高度的UITableViewCell contentSize 但不能减少宽度。

-> 我想减小UITableView 中的UITableViewCell contentSize 宽度。

【问题讨论】:

  • 我可以增加和减少内容单元格的高度,但我不能减少宽度...
  • 你有单元格类,在那个地方以编程方式减小宽度
  • 我试过但没用。高度可以改变但宽度没有?
  • www2.zippyshare.com/v/wk5fEzMi/file.html 见上图。这是来自 tableview。我想减小单元格宽度...
  • @Tamil_Arya 没有像 contentCell 这样的单元格属性..您想正确更改单元格内容大小。

标签: ios objective-c iphone ios7 ios6.0


【解决方案1】:

您不能使用单元格属性来减小单元格宽度。您需要更改 UITableView 框架大小。设置任何你想设置的宽度。

【讨论】:

  • 如果我们想根据 UITableView contentSize 框架而不是 UITableView 框架来更新 UITableViewCell 框架,它不起作用?
【解决方案2】:

// MyCustomUITableViewCell.m - (void)layoutSubviews {

self.bounds = CGRectMake(self.bounds.origin.x,self.bounds.origin.y,self.bounds.size.width - 50,self.bounds.size.height);

[super layoutSubviews];

} http://natashatherobot.com/ios-frame-vs-bounds-resize-basic-uitableview-cell/'

【讨论】:

    猜你喜欢
    • 2023-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多