對齊文本我在的tableView正常細胞,當我要對齊文本正確使用:問題與UITableViewCell的
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.textAlignment = UITextAlignmentRight;
}
但現在我想用UITableViewCell
爲還顯示detailTextLabel
我試着它便又對齊,但沒有任何反應:
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.textAlignment = UITextAlignmentRight;
cell.detailTextLabel.textAlignment = UITextAlignmentRight;
}
我同意。內置標籤有時會出現意想不到的行爲,有時會進行對齊和定位我知道在過去,我遇到過一個問題,就是在調整單元格大小時,內置標籤是如何自動重新對齊的,但創建的標籤不會自動重新對齊(這是我實際想要的行爲)。 – MikeS
@KDaker這是他唯一的結果嗎?因爲我想插入那裏動態文本,可以是不同的大小,我需要初始化它的CGRectMake的一些參數,我不知道,當我得到的文本 – vadim
你是否正在更改文本,而單元格是在視圖?或者當你回到它?因爲您仍然可以通過標記文本而不通過實例變量來分配文本。 – KDaker