The label of Swift Learning

Source: Internet
Author: User


How to use Uilabel
Let Label:uilabel = UILabel (Frame:cgrect (x:0, y:100, Width:view.frame.size.width, height:100))
Label.text = "Everybody loves Uncle Meng old, do not take medicine every day"
Label.textalignment = Nstextalignment.center
Label.numberoflines = 2
Set the display mode for text too long
Label.linebreakmode = Nslinebreakmode.bytruncatingmiddle
Automatically scale fonts according to text boxes for full display purposes
Label.adjustsfontsizetofitwidth = True
Font size Bold
Label.font = uifont.boldsystemfontofsize (14)
Normal
Label.font = uifont.systemfontofsize (14)
Label.textcolor = Uicolor.bluecolor ()

Set Shadow
Label.shadowcolor = Uicolor.cyancolor ()
Label.shadowoffset = Cgsizemake (1.0, 1.0)

Add a text label to the view
View.addsubview (label)
Add a click event to a label
Label.userinteractionenabled = True

Let Tap:uitapgesturerecognizer = UITapGestureRecognizer (target:self, Action: "Tap:")
Label.addgesturerecognizer (TAP)
}

Func Tap (Tap:uitapgesturerecognizer) {
Print ("Tihis is Click")}

The label of Swift Learning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.