/* Let apples = 3 let orange = 5 let L = 1.1 let Applesummary = "I has \ (apples) apples" Let fruitsummary = "I had \ (apples + orange) pieces of fruit." Let Isay = ' I love \ (L) you ' Print (isay) Let explicifloat:float = 4//print (fruitsummary) PR Int (explicifloat) Let label = "label" Let width = 94 let Widthlabel = Label + String (width) pr int (widthlabel) */ / * Initialize an array with a value array * /var shoppinglist = ["Catfish","Water","Tulips","agg","Water"] var dic = ["A":"a","B":"B",] shoppinglist[1] ="AAAAAA"Print (shoppinglist[0])/* Initialize an empty array and dictionary */Let Emptyarray = string["",""] () Let emptydictionary = Dictionary<string, Float > () print (emptydictionary) Let Textlabel = UILabel (Frame:cgrectmake (self. View. Frame. Size. Width/8, -, self. View. Frame. Size. Width*3/4, -)//Give label value Textlabel. Text="Now let's start learning how to create our first Swift control-uilabel"Sets whether to default line wrapping Textlabel. NumberOfLines=0Sets the label's background color var whitcolor = Uicolor (red:1.0, Green:1.0, Blue:1.0, Alpha:1.0) Textlabel. BackgroundColor= Whitcolor Self. View. Addsubview(Textlabel)//view Let view = UIView (Frame:cgrectmake ( -, -, -, -)) View. BackgroundColor= Uicolor. Bluecolor() Self. View. Addsubview(view)//textfield Let TextField = Uitextfield (Frame:cgrectmake ( -, $, $, -)) TextField. Text="haha"TextField. TextColor= Uicolor. Redcolor() Self. View. Addsubview(TextField)//button Let button = UIButton (Frame:cgrectmake ( -, -, Max, -)) button. BackgroundColor= Uicolor. Purplecolor() button. Titlelabel?. Text="1111"button. AddTarget(Self, Action:selector ("ButtonClick:"), forcontrolevents:uicontrolevents. Touchupinside) Self. View. Addsubview(button)//imageview let ImageView = Uiimageview (Frame:cgrectmake ( -, -, -, -)) ImageView. Image= UIImage (named:"Unknown") Self. View. Addsubview(ImageView)} Button listener func buttonclick (Btn:uibutton) {print (btn. Titlelabel?. Text) }! such as (http://img. Blog. Csdn. NET/20150605234753408)
Creation of Swift Base controls