UILineBreakModeWordWrap已弃用

时间:2013-10-17 21:52:05

标签: ios deprecated

当我编写此代码UILineBreakModeWordWrap并且我有

时,我的应用程序出了问题
  

UILineBreakModeWordWrap已弃用:首先在IOS 6中弃用“”并且   一段时间IOS 7“”

我的代码是:

NSString *texto = [[superArray objectAtIndex:indexPath.row]objectForKey:@"Text"];
CGSize tamanho=[texto sizeWithFont:[UIFont systemFontOfSize:16.0f]constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap];
UIImage *imagemBalao;

cell.label.lineBreakMode=UILineBreakModeWordWrap;

此代码中的相同问题GKPeerPickerController

(void)peerPickerControllerDidCancel:(GKPeerPickerController *)picker{
    picker.delegate = nil;
}

(void)peerPickerController:(GKPeerPickerController *)picker didConnectPeer:(NSString *)peerID toSession:(GKSession *) session {
    currentSession = session;
    session.delegate = self;
    [session setDataReceiveHandler:self withContext:nil];
    picker.delegate = nil;
    [picker dismiss];
}

有什么想法吗?

2 个答案:

答案 0 :(得分:4)

使用NSLineBreakByWordWrapping而不是UILineBreakMode。这是新枚举列表

 enum {
        NSLineBreakByWordWrapping = 0,
        NSLineBreakByCharWrapping,
        NSLineBreakByClipping,
        NSLineBreakByTruncatingHead,
        NSLineBreakByTruncatingTail,
        NSLineBreakByTruncatingMiddle
      };
     typedef NSUInteger NSLineBreakMode

答案 1 :(得分:0)

   NSString *texto = [[superArray objectAtIndex:indexPath.row] objectForKey:@"Text"];

    CGSize s = [texto sizeWithFont:[UIFont systemFontOfSize:16.0f] constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:NSLineBreakByWordWrapping];

another stack answer