1
在我的網頁基礎的應用,我想使用的UILabel斷行,我嘗試用下面的編碼,斷行
@"The farmer and his wife were entranced with joy and danced cheerfully because of their goose lays \n a golden egg",
self.titlestring.frame = CGRectMake(53, 620, 0, 37);
self.titlestringcop.frame = CGRectMake(53, 620, 918, 37);
[self fadein];
[self.titlestring setText:self.dataobject1];
[self.titlestringcop setText:self.dataobject1];
textstring.numberOfLines = 0;
titlestringcop.numberOfLines = 0;
CGSize labelSize = [textstring.text sizeWithFont:textstring.font
constrainedToSize:textstring.frame.size
lineBreakMode:textstring.lineBreakMode];
CGSize labelSize1 = [titlestringcop.text sizeWithFont:titlestringcop.font
constrainedToSize:titlestringcop.frame.size
lineBreakMode:titlestringcop.lineBreakMode];
textstring.frame = CGRectMake(
textstring.frame.origin.x, textstring.frame.origin.y,
textstring.frame.size.width, labelSize.height);
titlestringcop.frame = CGRectMake(
titlestringcop.frame.origin.x, titlestringcop.frame.origin.y,
titlestringcop.frame.size.width, labelSize1.height);
但不表現出任何區別嗎?請告訴我錯在我的代碼?
UILineBreakModeWordWrap其棄用??? –