搜索
您的当前位置:首页正文

怎样用代码设置cell中textlabel位置和大小,直接改是改

来源:二三娱乐

【新人求助】怎样用代码设置cell中textlabel位置和大小

如果你用系统cell的 detailtext 貌似是不能设置位置的,他就是固定的位置(为readonly属性)。

textLabel
和 detailTextLabel
是 readonly 所以你不能改变他们。
@property(nonatomic, readonly, retain) UILabel *textLabel@property(nonatomic, readonly, retain) UILabel *detailTextLabel

你得自己用一个 继承于 UITableViewCell 的类,来写自己的cell然后在 那个

-(UITableViewCell *)table………………   (UITableView 的delegate这个方法中){
static NSString *…………;
UITableViewCell *cell = ………………;  //这里的 UITableViewCell  换成你自己写的cell
if (nil == cell)
cell = [UITableViewCell alloc]init ………………; //这里的 UITableViewCell  也换成你自己写的cell
//后面不变
}

你自定制之后,自己设置detailtext

Top