2011-10-10 79 views
0

我做一本聖經應用程序,我已經完成了,當我點擊一個詩句我不應該highlighted.I不知道怎麼幹這事提供成爲襲擊了textview.I經文的顯示一個圖像網址,以表明我想要完全像這樣。 在此先感謝TextView的高亮顯示文本懷疑

.image

+0

是否有任何ios聖經的應用程序sourece代碼avilable供參考? – ICoder

回答

1

文本查看已經通過針對文本視圖我們可以得到反白標明的線路爲u問這個低於

.h文件中的代碼示例雙presssing一些財產

{ 
    UITextView *textView; 
} 
@property (nonatomic, retain) UITextView *text 

.m文件

-(void)setupTextView 
{ 
    self.textView = [[[UITextView alloc] initWithFrame:self.view.frame] autorelease]; 
    self.textView.textColor = [UIColor blackColor]; 
    self.textView.font = [UIFont fontWithName:@"Arial" size:18]; 
    self.textView.delegate = self; 
    self.textView.backgroundColor = [UIColor whiteColor]; 

    self.textView.text = @"Hello this is about the text view, the difference in text view and the text field is that you can display large data or paragraph in text view but in text field you cant."; 
    self.textView.returnKeyType = UIReturnKeyDefault; 
    self.textView.keyboardType = UIKeyboardTypeDefault; // use the default type input method (entire keyboard) 
    self.textView.scrollEnabled = YES; 

    // this will cause automatic vertical resize when the table is resized 
    self.textView.autoresizingMask = UIViewAutoresizingFlexibleHeight; 
    // note: for UITextView, if you don't like autocompletion while typing use: 
    // myTextView.autocorrectionType = UITextAutocorrectionTypeNo; 
    [self.view addSubview: self.textView]; 
} 

調用viewdidload中的方法

+0

但我想突出顯示的顏色爲黃色或橙色,而且我在textview中有大量的文本值,當用戶選擇一個詩節時,它會突出顯示該詩歌 – ICoder