Ho una sottoclasse UITableViewCell.Impossibile aggiornare il frame dell'oggetto UI in UITableViewCell
Ho bisogno di cambiare dinamicamente il frame di un UILabel.
Ecco che cosa ho fatto:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"messageCell";
MessageCell *cell = (MessageCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.Content.Text = @"Content!";
[cell.Content setFrame:CGRectMake(0, 0, 10, 10)];
}
Il testo del UILabel non cambia quindi questo non è un problema IBOutlet. Il frame rimane lo stesso definito in IB.
ho fatto cose del genere prima, quindi non sono davvero sicuro di cosa è andato storto qui ...
Grazie per qualsiasi aiuto.
Edit:
Io uso
[self.tableView registerNib:[UINib nibWithNibName:@"MessageCell" bundle:nil]
forCellReuseIdentifier:@"MessageCell"];
in viewDidLoad
rimane lo stesso sfortunato ... – BenB
Great Daniel ha funzionato per me. Finalmente hai dato una soluzione ad un problema molto noto. –