ios - PFTableViewCell 在 iOS 上乱七八糟

标签 ios parse-platform

我使用 PFQueryTableViewController 从 PFObject 中检索数据。这终于成功了,但是,textLabel 和 detailTextLabel 在它们自己之上。图片下方是我的单元格代码。当我将此 customCell 用于普通 TableView 时,文本标签的间距适当。

enter image description here

 - (void)layoutSubviews {
    [super layoutSubviews];
    self.imageView.frame = CGRectMake(1,1,69,69);
    float limgW =  self.imageView.image.size.width;
    if(limgW > 0) {
        self.textLabel.frame = CGRectMake(74,self.textLabel.frame.origin.y,self.textLabel.frame.size.width,self.textLabel.frame.size.height);
        self.detailTextLabel.frame = CGRectMake(74,self.detailTextLabel.frame.origin.y,self.detailTextLabel.frame.size.width,self.detailTextLabel.frame.size.height);
    }
}

最佳答案

您可以像这样管理框架:

    self.textLabel.frame = CGRectMake(74,self.textLabel.frame.origin.y,self.textLabel.frame.size.width,self.textLabel.frame.size.height);
    self.detailTextLabel.frame = CGRectMake(74,self.detailTextLabel.frame.origin.y+self.textLabel.frame.size.height,self.detailTextLabel.frame.size.width,self.detailTextLabel.frame.size.height);

这样 detailTextLabel 将在 textLabel 完成后启动...

祝一切顺利!!!

关于ios - PFTableViewCell 在 iOS 上乱七八糟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27791750/

相关文章:

ios - 如何在 iOS 中使用 PFQuery 获取表中的所有数据?

ios - 将 32 位 iOS 应用程序移植到 64 位有什么好处?

ios - 结合使用 Frank 和 RestKit 头文件

ios - 保存 UIPickerView 数据进行解析

java - RecyclerView 多次显示适配器中的最后一项。需要所有适配器项目显示在 RecyclerView 中

typescript - 如何使用 Typescript 而不是 Javascript 在解析服务器中编写云代码?

ios - ARC递归方法中的EXC_BAD_ACCESS代码= 2

ios - 如何设置地址簿访问请求警报 View 的文本?

ios - iOS 13 会在什么条件下要求用户授予 'Always' 位置访问权限?

swift - PFGeoPoint.geoPointForCurrentLocationInBackground