次の画像のようにカスタマイズされたTableViewがあります

私の考えはtableview4行目にあり、その時間がないので、左を左と同じにimage設定したいのですが、どうすればこれを行うことができますか?label frameimage
次の画像のようにカスタマイズされたTableViewがあります

私の考えはtableview4行目にあり、その時間がないので、左を左と同じにimage設定したいのですが、どうすればこれを行うことができますか?label frameimage
ラベルを imageView と同じ左座標に配置する場合は、次のコードを使用できます。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// do the below code after setting the image in your imageView.
if (imageView.image == nil)
{
CGRect rectNew = CGRectMake(imageView.frame.origin.x, cell.textLabel.frame.origin.y, cell.textLabel.frame.size.width, cell.textLabel.frame.size.height);
cell.textLabel.frame = rectNew;
}
}
メソッドでcellForRowAtIndexPath:画像がnilの場合、imageViewのフレームを次のcell.textLable. ように設定します..
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (imageView.image == nil) {
imageView.hidden = YES;
cell.textLabel.frame = CGRectMake(imageView.frame.origin.x, imageView.frame.origin.y, setWidth, setHight);//set Hight and width of yout textlable of cell
}
}