xcode UILabel建立和隱藏

2022-08-27 03:09:11 字數 907 閱讀 8325

// 建立label

uilabel *label = [[uilabel alloc] init];

// 設定顯示的文字

label.text = @"hello world!hello world!hello world!hello world!";

// 設定frame

label.frame = cgrectmake(50, 50, 200, 20);

// 設定字型

label.font = [uifont systemfontofsize:15];

// 設定字型顏色

label.textcolor = [uicolor redcolor];

// 設定背景顏色

label.backgroundcolor = [uicolor greencolor];

// 設定對齊模式  左邊 右邊 中間

label.textalignment = nstextalignmentcenter;

// 設定行數

label.numberoflines = 0; // 設定為0,就自動換行

// 設定換行模式

label.linebreakmode = nslinebreakbyclipping;

//設定文字的陰影色彩和透明度

label.shadowcolor=[uicolor colorwithwhite:0.0 alpha:1.0];

//設定陰影的傾斜角度

label.shadowoffset=cgsizemake(1.5, 1.5);

1.通過alpha控制label顯示還是隱藏,alpha = 0表示隱藏,alpha = 1表示顯示

2.通過hidden控制label顯示還是隱藏,hidden = yes表示顯示,hidden = no表示隱藏

xcode UILabel分頁計算(轉來收藏)

nsarray getpagesofstring nsstring cache withfont uifont font inrect cgrect relse cgsize parasize para sizewithfont font constrainedtosize r.size lineb...

建立 和 刪除 oracle job

begin sys.dbms scheduler.create job job name reg pwdwronglimit job type stored procedure job action pro pwdwronglimit ctrl start date to date 01 01 20...

建立和使用DLL

首先建立個dll工程 win32控制台 dll工程 新增標頭檔案和cpp檔案,如下 ifndef dll test h define dll test h class declspec dllexport ctest endif include dll test.h include ctest ct...