iOS UIButton文本没有被截断

时间:2012-12-22 00:05:48

标签: ios ipad uibutton uistoryboard truncate

我正在创建一个从数据生成UITableView的应用程序。我有一个自定义UITableViewCell,其中包含带文本的UIButton。其中一个生成的按钮的标题对于UIButton来说太长了,但是没有像我在UIStoryBoard中选择的那样被截断。单元格是在我的UITableViewController函数中创建的 原型细胞正常- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

我无法添加图片,因为我是新用户,但这里有几个图片链接:

UIStoryBoard设置:truncate setting

标题在UIButton边界之外流血:overflowing text

有谁知道如何解决这个问题。它早先工作了。我改变了UIButton的大小和标题文本的字体,但我认为这不应该有所作为。

以下是我在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

中设置按钮文字的代码
    CellIdentifier = @"PopoverCell";
    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    ((MSPopoverCell *)cell).nameLabel.text = data.FullName; //setting the label, works fine
    [((MSPopoverCell *)cell).button setTitle:data.DisplayString forState:UIControlStateNormal];//setting the button title, bleeds over

另外,我是stackoverflow的新手,所以如果我错过了我应该包含的任何内容,请给我一些友好的建议。 谢谢, 最大

0 个答案:

没有答案