开发者

highlight scrolling text on iphone

i'm in troubled show lyrics .i use uitextview show lyrics code snips

IBOutlet UILabel *lrcshow;
IBOutlet开发者_开发知识库 UITextView *showlrc;

self.lrcshow.text = [lrcDictss objectForKey:
[NSString stringWithFormat:@"%d",(int)self.player.currentTime]];
if (self.lrcshow.text!=nil) {
    NSRange selection = [self.showlrc.text rangeOfString:self.lrcshow.text]; 
    if( selection.location != NSNotFound ){
        showlrc.selectedRange = selection; 
   }
}

lyrics line by line scrolling show,the problem is now playing(selectedRange) lyric is not highlight, i want this line highlight how can i code ? any suggestion?or use calayer 、cgcontext quartz core instead it? how can I do it ?

ps.for me english is difficult I want to achieve smooth scrolling effect lyrics show

lyrics style show pic url :

this is my app style: http://www.flickr.com/photos/53054715@N05/5360345226/

this is good style : flickr.com/photos/53054715@N05/5359722887/


I think I understand what you mean... you want to highlight a text and selectedRange is not working right?

If so then read this:

selectedRange only works when the keyboard is showing. In your lyrics app you don't want that right? So you will need at least a CALayer to make it look like is selected. Also you need the coordinates of the text and that is no a simple task.

If your text is static (the font, size, frame width never changes) then you could have coordinates of the text in your dictionary, so you can resize your CALayer accordingly

Hope it helps. GoodLuck

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜