2014-09-24 89 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