本文整理汇总了Java中org.robovm.apple.uikit.UILabel.setLineBreakMode方法的典型用法代码示例。如果您正苦于以下问题:Java UILabel.setLineBreakMode方法的具体用法?Java UILabel.setLineBreakMode怎么用?Java UILabel.setLineBreakMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robovm.apple.uikit.UILabel
的用法示例。
在下文中一共展示了UILabel.setLineBreakMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateTextArea
import org.robovm.apple.uikit.UILabel; //导入方法依赖的package包/类
private UIView generateTextArea(String title, String text,
UIView previousView) {
UILabel textViewTitle = new UILabel();
textViewTitle.setTranslatesAutoresizingMaskIntoConstraints(false);
textViewTitle.setLineBreakMode(NSLineBreakMode.TruncatingTail);
textViewTitle.setNumberOfLines(0);
textViewTitle.setText(title);
textViewTitle.setTextAlignment(NSTextAlignment.Center);
textViewTitle.setFont(UIFont.getBoldSystemFont(UIFont
.getButtonFontSize()));
UILabel textViewText = new UILabel();
textViewText.setTranslatesAutoresizingMaskIntoConstraints(false);
textViewText.setLineBreakMode(NSLineBreakMode.WordWrapping);
textViewText.setNumberOfLines(0);
textViewText.setText(text);
textViewText.setFont(UIFont.getSystemFont(UIFont
.getSmallSystemFontSize()));
mainView.addSubview(textViewTitle);
mainView.addSubview(textViewText);
// mainView.addSubview(toReturn);
// uiview
// if (previousView == null) {
// mainView.addConstraint(NSLayoutConstraint.create(toReturn,
// NSLayoutAttribute.Top, NSLayoutRelation.Equal, mainView,
// NSLayoutAttribute.Top, 1, 10));
// } else {
// mainView.addConstraint(NSLayoutConstraint.create(toReturn,
// NSLayoutAttribute.Top, NSLayoutRelation.Equal,
// previousView, NSLayoutAttribute.Bottom, 1, 10));
// }
// mainView.addConstraint(NSLayoutConstraint.create(toReturn,
// NSLayoutAttribute.Width, NSLayoutRelation.Equal, mainView,
// NSLayoutAttribute.Width, 1, 0));
// mainView.addConstraint(NSLayoutConstraint.create(toReturn,
// NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, mainView,
// NSLayoutAttribute.CenterX, 1, 0));
// title
mainView.addConstraint(NSLayoutConstraint.create(textViewTitle,
NSLayoutAttribute.Width, NSLayoutRelation.Equal, mainView,
NSLayoutAttribute.Width, 1, -40));
mainView.addConstraint(NSLayoutConstraint.create(textViewTitle,
NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, mainView,
NSLayoutAttribute.CenterX, 1, 0));
if (previousView == null) {
mainView.addConstraint(NSLayoutConstraint.create(textViewTitle,
NSLayoutAttribute.Top, NSLayoutRelation.Equal, mainView,
NSLayoutAttribute.Top, 1, 10));
} else {
mainView.addConstraint(NSLayoutConstraint.create(textViewTitle,
NSLayoutAttribute.Top, NSLayoutRelation.Equal,
previousView, NSLayoutAttribute.Bottom, 1, 10));
}
// text
mainView.addConstraint(NSLayoutConstraint.create(textViewText,
NSLayoutAttribute.Width, NSLayoutRelation.Equal, mainView,
NSLayoutAttribute.Width, 1, -40));
mainView.addConstraint(NSLayoutConstraint.create(textViewText,
NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, mainView,
NSLayoutAttribute.CenterX, 1, 0));
mainView.addConstraint(NSLayoutConstraint.create(textViewText,
NSLayoutAttribute.Top, NSLayoutRelation.Equal, textViewTitle,
NSLayoutAttribute.Bottom, 1, 10));
return textViewText;
}
示例2: PAPBaseTextCell
import org.robovm.apple.uikit.UILabel; //导入方法依赖的package包/类
public PAPBaseTextCell(UITableViewCellStyle style, String reuseIdentifier) {
super(style, reuseIdentifier);
setClipsToBounds(true);
horizontalTextSpace = PAPBaseTextCell.getHorizontalTextSpaceForInsetWidth(cellInsetWidth);
setOpaque(true);
setSelectionStyle(UITableViewCellSelectionStyle.None);
setAccessoryType(UITableViewCellAccessoryType.None);
setBackgroundColor(UIColor.clear());
mainView = new UIView(getContentView().getFrame());
mainView.setBackgroundColor(UIColor.white());
avatarImageView = new PAPProfileImageView();
avatarImageView.setBackgroundColor(UIColor.clear());
avatarImageView.setOpaque(true);
avatarImageView.getLayer().setCornerRadius(16);
avatarImageView.getLayer().setMasksToBounds(true);
mainView.addSubview(avatarImageView);
nameButton = new UIButton(UIButtonType.Custom);
nameButton.setBackgroundColor(UIColor.clear());
if (reuseIdentifier.equals("ActivityCell")) {
nameButton.setTitleColor(UIColor.white(), UIControlState.Normal);
nameButton.setTitleColor(UIColor.fromRGBA(114f / 255f, 114f / 255f, 114f / 255f, 1),
UIControlState.Highlighted);
} else {
nameButton.setTitleColor(UIColor.fromRGBA(34f / 255f, 34f / 255f, 34f / 255f, 1), UIControlState.Normal);
nameButton.setTitleColor(UIColor.fromRGBA(114f / 255f, 114f / 255f, 114f / 255f, 1),
UIControlState.Highlighted);
}
nameButton.getTitleLabel().setFont(UIFont.getBoldSystemFont(13));
nameButton.getTitleLabel().setLineBreakMode(NSLineBreakMode.TruncatingTail);
nameButton.addOnTouchUpInsideListener(didTapUserButton);
mainView.addSubview(nameButton);
contentLabel = new UILabel();
contentLabel.setFont(UIFont.getSystemFont(13));
if (reuseIdentifier.equals("ActivityCell")) {
contentLabel.setTextColor(UIColor.white());
} else {
contentLabel.setTextColor(UIColor.fromRGBA(34f / 255f, 34f / 255f, 34f / 255f, 1));
}
contentLabel.setNumberOfLines(0);
contentLabel.setLineBreakMode(NSLineBreakMode.WordWrapping);
contentLabel.setBackgroundColor(UIColor.clear());
mainView.addSubview(contentLabel);
timeLabel = new UILabel();
timeLabel.setFont(UIFont.getSystemFont(11));
timeLabel.setTextColor(UIColor.fromRGBA(114f / 255f, 114f / 255f, 114f / 255f, 1));
timeLabel.setBackgroundColor(UIColor.clear());
mainView.addSubview(timeLabel);
avatarImageButton = new UIButton(UIButtonType.Custom);
avatarImageButton.setBackgroundColor(UIColor.clear());
avatarImageButton.addOnTouchUpInsideListener(didTapUserButton);
mainView.addSubview(avatarImageButton);
separatorImage = new UIImageView(UIImage.getImage("SeparatorComments").newResizableImage(
new UIEdgeInsets(0, 1, 0, 1)));
getContentView().addSubview(mainView);
}
示例3: MyOverlayViewController
import org.robovm.apple.uikit.UILabel; //导入方法依赖的package包/类
public MyOverlayViewController(final MyMovieViewController movieViewController) {
UIView view = getView();
view.setFrame(new CGRect(0, 0, 123, 57));
view.setAlpha(0.8);
view.setBackgroundColor(UIColor.fromWhiteAlpha(0.33, 1));
closeButton = new UIButton(UIButtonType.RoundedRect);
closeButton.setFrame(new CGRect(26, 32, 74, 18));
closeButton.setTitle("Close Movie", UIControlState.Normal);
closeButton.setTitleColor(UIColor.white(), UIControlState.Highlighted);
closeButton.getTitleLabel().setFont(UIFont.getSystemFont(11));
closeButton.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener() {
@Override
public void onTouchUpInside(UIControl control, UIEvent event) {
movieViewController.closeOverlay();
}
});
view.addSubview(closeButton);
UILabel playStateLabel = new UILabel(new CGRect(8, 15, 51, 15));
playStateLabel.setText("Play State:");
playStateLabel.setTextColor(UIColor.darkText());
playStateLabel.setFont(UIFont.getSystemFont(9));
view.addSubview(playStateLabel);
moviePlaybackStateText = new UILabel(new CGRect(57, 18, 62, 11));
moviePlaybackStateText.setTextColor(UIColor.darkText());
moviePlaybackStateText.setContentMode(UIViewContentMode.Left);
moviePlaybackStateText.setFont(UIFont.getSystemFont(9));
moviePlaybackStateText.setLineBreakMode(NSLineBreakMode.TruncatingTail);
view.addSubview(moviePlaybackStateText);
UILabel loadStateLabel = new UILabel(new CGRect(5, 3, 51, 15));
loadStateLabel.setText("Load State:");
loadStateLabel.setTextColor(UIColor.darkText());
loadStateLabel.setFont(UIFont.getSystemFont(9));
view.addSubview(loadStateLabel);
movieLoadStateText = new UILabel(new CGRect(57, 6, 62, 11));
movieLoadStateText.setTextColor(UIColor.darkText());
movieLoadStateText.setContentMode(UIViewContentMode.Left);
movieLoadStateText.setFont(UIFont.getSystemFont(9));
movieLoadStateText.setLineBreakMode(NSLineBreakMode.TruncatingTail);
view.addSubview(movieLoadStateText);
}