How to Move text on navigation bar

后端 未结 4 1986
生来不讨喜
生来不讨喜 2021-01-16 03:52

Hi I have to move the text on navigation bar..I don\'t have any idea about scrolling text. Is anybody have idea about this please let me know.

Thanks

4条回答
  •  遥遥无期
    2021-01-16 04:38

    I think you want to move label text exactly same like in iphone music player application. If yes then do the following.

    1`. Download Marquee Label files from this link 'https://github.com/cbpowell/MarqueeLabel'.`
    
    
    2.   - (void)addMovingLabelText { 
                MarqueeLabel *_lectureName = [[MarqueeLabel alloc] initWithFrame:CGRectMake(0,20,200, 20) duration:5.0 andFadeLength:10.0f];
                [_lectureName setTextAlignment:NSTextAlignmentCenter];
                [_lectureName setBackgroundColor:[UIColor clearColor]];
                [_lectureName setText:@"I am a moving Label in iphone Application"];
                _lectureName.adjustsFontSizeToFitWidth=NO;
                [_lectureName setAnimationCurve:UIViewAnimationOptionCurveEaseIn];
                [self.navigationItem setTitleView:_lectureName];
    }
    
    3. call addMovingLabelText from viewDidLoad
    

提交回复
热议问题