Ios 可可超链接标签问题?
我的应用程序中有一个超链接标签。单击它可以打开我想要的应用程序。 问题是在我点击它后,标签的字体大小会自动缩小。 有没有办法避免这种情况??Ios 可可超链接标签问题?,ios,objective-c,macos,cocoa,Ios,Objective C,Macos,Cocoa,我的应用程序中有一个超链接标签。单击它可以打开我想要的应用程序。 问题是在我点击它后,标签的字体大小会自动缩小。 有没有办法避免这种情况?? 请为这个问题提出解决方案。提前感谢我建议您使用带有UIButtonTypeCustom和清晰背景的UIButton,而不是UILabel。它看起来像UILabel,在action方法中,您可以执行任何任务 UIButton *btn = [[UIButton alloc] initWithFrame:btn_frame];
请为这个问题提出解决方案。提前感谢我建议您使用带有UIButtonTypeCustom和清晰背景的UIButton,而不是UILabel。它看起来像UILabel,在action方法中,您可以执行任何任务
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,这里的链接可能会对您有所帮助。。
您能否展示一些关于如何处理单击的代码示例?