您必须使用 UITextView 进行此类检查
UITextView *aboutStable = [[UITextView alloc] init];
[aboutStable setFont:[UIFont fontWithName:@"Helvetica" size:12]];
[aboutStable setText:@"Write your long text here............iphonemaclover is great"];
[aboutStable setTextColor:[UIColor grayColor]];
[aboutStable setBackgroundColor:[UIColor clearColor]];
[aboutStable setTextAlignment:UITextAlignmentCenter];
[aboutStable setFrame:CGRectMake(0, 302, 320, 79)];
[self addSubview:aboutStable];
并使其不可编辑所以设置
[aboutStable setUserInteractionEnabled:NO]
应该这样做
如果您需要滚动:
aboutStable.editable = NO;
或者如果你的文字更多,那么你也可以在其中设置滚动视图......
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 195, 280, 10)];
textView.text = @"your long text here";
textView.font = [UIFont fontWithName:@"Hevlatica" size:14];
[self.scrollView addSubview:textView];//add scrollview using Xib and set property of it.
CGRect descriptionFrame = textView.frame;
descriptionFrame.size.height = textView.contentSize.height;
textView.frame = descriptionFrame;
或者您可以在此示例代码中查看更多详细信息
编辑不同的视网膜显示
CGRect screenRect = [[UIScreen mainScreen] bounds];
if (screenRect.size.height == 568.0f)
{
//condition for iphone 5 screen
}
else
{
//condition for retina display 3.5
}