I have a custom UITableViewCell with and .xib. In the xib I have set the cell width to 320.
I want to position a UIlabel inside the cell relative to the cell width. However, in the code during runtime the Bounds.width of the cell is always 320, as set in the xib, and not the actual width of the screen/UITableView which I need to position the UILabel correctly.
The width should be different for iphone 5, 6 and 6+ obviously, at least during runtime, but it's always set to 320 on all devices. What am I missing?
Thanks!
EDIT
Here is a tiny bit of code.
var newFrame = _lblDetail.Frame;
newFrame.X = Bounds.Width - 55; //get current width of cell, and subtract 55 and set that as the X value of the frame for the label
_lblDetail.Frame = newFrame; //set new frame on label
Aucun commentaire:
Enregistrer un commentaire