uilabel *label =[[uilabel alloc] init];label.frame = self.view.bounds; //
設定大小
label.autoresizingmask =uiviewautoresizingflexibleleftmargin
|uiviewautoresizingflexiblewidth
|uiviewanimationtransitionnone
|uiviewautoresizingflexibleheight
| uiviewanimationtransitionflipfromleft; //
設定label與父容器的關係
label.backgroundcolor = [uicolor blackcolor]; //
背景顏色
label.textcolor = [uicolor redcolor]; //
文字顏色
label.font = [uifont fontwithname:@"
zapfino
" size:48.0f]; //
字型label.adjustsfontsizetofitwidth = yes; //
當文字超過label寬度時是否縮放字型
label.numberoflines = 10; //
行數label.highlighted = yes; //
點選時是否高亮
label.highlightedtextcolor = [uicolor graycolor]; //
高亮時的顏色
label.shadowoffset = cgsizemake(1, 1); //
陰影的偏移值
label.shadowcolor = [uicolor greencolor]; //
陰影顏色
UILabel 複製
新增一個長按響應方法 void addlongpressgesturerecognizer uilongpressgesturerecognizer longpress uilongpressgesturerecognizer alloc initwithtarget self action sel...
AutoLayout UILabel佈局
一 內容決定寬度 實現autolayout模式下面,uilabel跟隨內容大小自動擴張,在storyboard中拖拽一個uilabel,將其...
標籤UILabel的講解
1 文字 1 1普通文字 內容text 字型大小font 字型顏色textcolor 字型高亮顏色highlightedtextcolor 是否顯示高亮highlighted。 顏色方面可以使用漸變顏色 2 文字陰影 陰影顏色shadowcolor 陰影偏移量shadowoffset。 3 文字欄 ...