0

我面臨在不同的推送視圖中有長標題的問題。我想動態調整它的大小,並且我根本沒有任何問題,但是對於很長的標題,這可能會很難看,所以我想到了在動畫中顯示文本的文本橫幅。UINavigationController titleView動畫

有沒有辦法使用的UIView動畫與titleview的移動爲整個文本(屏蔽)的方法嗎?

乾杯

+0

這是否意味着您想要將標題移動爲選取框?對? –

+0

http://stackoverflow.com/questions/10911252/how-to-move-text-on-navigation-bar – iPatel

回答

0

嘗試這種自定義控件第一..

AutoScroll Label

方法2

UIView *myView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, 300, 30)]; 
UILabel *title = [[UILabel alloc] initWithFrame: CGRectMake(40, 0, 300, 30)]; 

title.text = NSLocalizedString(@"My Title", nil); 
[title setTextColor:[UIColor whiteColor]]; 
[title setFont:[UIFont boldSystemFontOfSize:20.0]]; 

[title setBackgroundColor:[UIColor clearColor]]; 
UIImage *image = [UIImage imageNamed:@"MyLogo.png"]; 
UIImageView *myImageView = [[UIImageView alloc] initWithImage:image]; 

myImageView.frame = CGRectMake(0, 0, 30, 30); 
myImageView.layer.cornerRadius = 5.0; 
myImageView.layer.masksToBounds = YES; 
myImageView.layer.borderColor = [UIColor lightGrayColor].CGColor; 
myImageView.layer.borderWidth = 0.1; 

[myView addSubview:title]; 
[myView setBackgroundColor:[UIColor clearColor]]; 
[myView addSubview:myImageView]; 
self.navigationItem.titleView = myView; 
+0

這對您有幫助嗎? – user1673099

0

有很多免費的開源控件用於此目的,但是這是我用它的方便的一個控制 TickerView

相關問題