2013-07-07 22 views

回答

0

你必須使用的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; 

或者如果你的文字是sti LL更多,那麼你可以設置滾動型的太...

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; 

,或者你可以在這個sample code

編輯不同的Retina顯示屏

CGRect screenRect = [[UIScreen mainScreen] bounds]; 
if (screenRect.size.height == 568.0f) 
    { 
    //condition for iphone 5 screen 
    } 
else 
{ 
//condition for retina display 3.5 
} 
+0

確定這裏查看更詳細的,我發現[aboutStable setFrame:CGRectMake(0,0,320,400)];是textview的完美矩形。但我只是意識到一件事,如果用戶使用視網膜顯示或另一個具有不同大小的手機。在這種情況下如何處理多種尺寸的iphone。 –

+0

檢查編輯部分在上面的答案不要忘記upvote,如果它可以幫助你! – iphonemaclover

相關問題