objective-c 使用 AutoResizingMask 将 UILabe 对齐到 UitableViewCell 内部
objective-c Align UILabe to right inside UitableViewCell using AutoResizingMask
我正在创建一个 iPhone 应用程序,现在我正在尝试使用自动调整大小蒙版将自定义 table 视图单元格中的 uilabel
对齐到右侧,我正在界面中执行此操作生成器和我正在使用情节提要,但我遇到的问题是当我在 iphone 6 模拟器中使用 运行 应用程序时标签就消失了,当我将标签对齐到 table 视图单元格,但奇怪的是,当我尝试将 table 视图单元格的标签右对齐时它不起作用,我应该怎么做?
注意:我不需要对齐 uilabel 文本,但需要将 uilabel 本身对齐。
the answer is used for my project , please customize the x, y , width and height as you need
我也遇到同样的问题,所以我按照这个方法cellForRowAtIndexPath
cell.yourlableName.frame=CGRectMake(add your label x - position,add your label Y position, [[UIScreen mainScreen] bounds].size.width- add your label width, add your label Height ); for example in your iPhone 4 width is 320 so reduce the width 320-yourlabel width,
否则在您的自定义单元格中调用此行 class
- (void)awakeFromNib {
cell.yourlableName.frame=CGRectMake(180.0f,220.0f, [[UIScreen mainScreen] bounds].size.width-216.0f, 19.0f);
}
它在所有设备上对我来说工作正常,它完美地显示在右侧。
我正在创建一个 iPhone 应用程序,现在我正在尝试使用自动调整大小蒙版将自定义 table 视图单元格中的 uilabel
对齐到右侧,我正在界面中执行此操作生成器和我正在使用情节提要,但我遇到的问题是当我在 iphone 6 模拟器中使用 运行 应用程序时标签就消失了,当我将标签对齐到 table 视图单元格,但奇怪的是,当我尝试将 table 视图单元格的标签右对齐时它不起作用,我应该怎么做?
注意:我不需要对齐 uilabel 文本,但需要将 uilabel 本身对齐。
the answer is used for my project , please customize the x, y , width and height as you need
我也遇到同样的问题,所以我按照这个方法cellForRowAtIndexPath
cell.yourlableName.frame=CGRectMake(add your label x - position,add your label Y position, [[UIScreen mainScreen] bounds].size.width- add your label width, add your label Height ); for example in your iPhone 4 width is 320 so reduce the width 320-yourlabel width,
否则在您的自定义单元格中调用此行 class
- (void)awakeFromNib {
cell.yourlableName.frame=CGRectMake(180.0f,220.0f, [[UIScreen mainScreen] bounds].size.width-216.0f, 19.0f);
}
它在所有设备上对我来说工作正常,它完美地显示在右侧。