Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在导航栏上移动文本_Iphone_Ipad_Uinavigationbar - Fatal编程技术网

Iphone 如何在导航栏上移动文本

Iphone 如何在导航栏上移动文本,iphone,ipad,uinavigationbar,Iphone,Ipad,Uinavigationbar,嗨,我必须移动导航栏上的文本。我不知道如何滚动文本。有人知道这件事吗?请告诉我 谢谢,导航栏可以用你自己的标题视图定制,所以你所需要做的就是创建一个包含滚动文本的视图。因为SDK中没有实现这种效果的组件,所以您必须在开源库中寻找一个组件,或者创建自己的组件。我从未使用过它,但看看这个嗯,导航栏可以用你自己的标题视图定制,所以你所需要做的就是创建一个包含滚动文本的视图。因为SDK中没有实现这种效果的组件,所以您必须在开源库中寻找一个组件,或者创建自己的组件。我从未使用过它,但看看这一个我认为您希望

嗨,我必须移动导航栏上的文本。我不知道如何滚动文本。有人知道这件事吗?请告诉我


谢谢,导航栏可以用你自己的标题视图定制,所以你所需要做的就是创建一个包含滚动文本的视图。因为SDK中没有实现这种效果的组件,所以您必须在开源库中寻找一个组件,或者创建自己的组件。我从未使用过它,但看看这个

嗯,导航栏可以用你自己的标题视图定制,所以你所需要做的就是创建一个包含滚动文本的视图。因为SDK中没有实现这种效果的组件,所以您必须在开源库中寻找一个组件,或者创建自己的组件。我从未使用过它,但看看这一个

我认为您希望移动标签文本,就像在iphone音乐播放器应用程序中一样。如果是,则执行以下操作

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

我认为您希望移动标签文本,就像在iphone音乐播放器应用程序中一样。如果是,则执行以下操作

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

将此文件添加到项目中,并将其导入到类中,然后在视图中添加以下命令。我希望您的应用程序使用的是基于导航的模板

然后在viewdidload中

AutoScrollLabel *autoScrollLabel=[[AutoScrollLabel alloc] initWithFrame:CGRectMake(10, 15, 320, 16)];
autoScrollLabel.text = @"Hi Mom!  How are you?  I really ought to write more often.";
autoScrollLabel.textColor = [UIColor whiteColor];
//self.title = @"Resources";
//self.title = @"%@"autoScrollLabel;
[self.navigationController.navigationBar addSubview:autoScrollLabel];

将此文件添加到项目中,并将其导入到类中,然后在视图中添加以下命令。我希望您的应用程序使用的是基于导航的模板

然后在viewdidload中

AutoScrollLabel *autoScrollLabel=[[AutoScrollLabel alloc] initWithFrame:CGRectMake(10, 15, 320, 16)];
autoScrollLabel.text = @"Hi Mom!  How are you?  I really ought to write more often.";
autoScrollLabel.textColor = [UIColor whiteColor];
//self.title = @"Resources";
//self.title = @"%@"autoScrollLabel;
[self.navigationController.navigationBar addSubview:autoScrollLabel];

Swift 5进近,带有
MarqueeLabel

    let title = MarqueeLabel(frame: CGRect.zero, duration: 20, fadeLength: 10)
    title.textAlignment = .center
    title.textColor = .white
    title.text = header

    navigationController?.navigationBar.topItem?.titleView = title

Swift 5进近,带有
MarqueeLabel

    let title = MarqueeLabel(frame: CGRect.zero, duration: 20, fadeLength: 10)
    title.textAlignment = .center
    title.textColor = .white
    title.text = header

    navigationController?.navigationBar.topItem?.titleView = title

您想在触摸屏上移动文本还是自动移动文本?您想在触摸屏上移动文本还是自动移动文本?