2014-09-24 96 views
-3

我在我的應用程序中有一個超鏈接標籤。點擊它打開我想要的應用程序。 問題是我點擊它後,標籤的字體大小自動縮小。 有沒有辦法避免這個? 請爲此問題提出解決方案。在此先感謝可可超鏈接標籤問題?

+2

你能表現出一定的代碼示例,在點擊是如何處理的? – Ayu 2014-09-24 11:17:13

回答

0

我建議你使用UIButtonUIButtonTypeCustom和清晰的背景,而不是UILabel。它看起來像UILabel,並且在操作方法中可以執行任何任務。

 UIButton *btn = [[UIButton alloc] initWithFrame:btn_frame]; 
     [btn setBackgroundColor:[UIColor clearColor]]; 
     [btn addTarget:self action:@selector(DoSomething) forControlEvents:UIControlEventTouchUpInside]; 
     [btn setTitle: @"Button_Title" forState: UIControlStateNormal]; 
     [btn setTitleColor: #your_choice forState:UIControlStateNormal]; 
     [btn setTitleColor: #your_choice forState:UIControlStateHighlighted]; 
     btn.titleLabel.font = #your_choice 
     btn.titleLabel.textAlignment = #your_choice; 
     btn.contentVerticalAlignment = #your_choice; 

如果還是你想的UILabel這裏是鏈接可以幫助你.. Attributed Label