通過UIKit框架在View中畫出文字 掌握

2021-10-05 16:23:51 字數 1572 閱讀 2710

nsstring *str = @"小馬哥";
//建立字典

nsmutabledictionary *dict = [nsmutabledictionary dictionary];
//字型大小

dict[nsfontattributename] = [uifont systemfontofsize:40];
//字型顏色

dict[nsforegroundcolorattributename] = [uicolor redcolor];
//設定字型描邊顏色

dict[nsstrokecolorattributename] = [uicolor greencolor];
//設定字型描邊粗細

dict[nsstrokewidthattributename] = @3;
//設定陰影

nsshadow *shaw = [[nsshadow alloc] init];

dict[nsshadowattributename] = shaw;(這個**需要在逗設定完成了之後最後執行)

//設定陰影顏色

shaw.shadowcolor = [uicolor bluecolor];
//設定陰影偏移量

shaw.shadowoffset = cgsizemake(30,20);
//設定陰影模糊

shaw.shadowblurradius = 3;
//將文字按照字典的描述畫出來

1)不會自動換行

[str drawatpoint:cgpointzero withattributes:dict];
2)自動換行

[str drawinrect:rect withattributes:dict];
//建立

uiimage *image = [uiimage imagenamed:@"《名稱》"];
//裁剪(超過裁剪區域以外的內容,都會被自動裁剪掉)

//在繪製之前做這個操作

uirectclip(cgrectmake(0,0,50,50));
//繪製原始大小(最開始的大小)

[image drawatpoint:cgpointzero];
//繪製出來填充樣式的(通過拉伸)

[image drawinrect:rect];
//繪製平鋪樣式的(像鋪地磚一樣的)

[image drawaspatterninrect:rect];
uirectfill(cgrectmake(20,20,20,20));

quartz排程框架在web中應用例項

quartz排程框架在web中應用例項 1.在web.xml中配置 初始化quartz 相關servlet 注意 其中配置引數為 quartz.properties檔案 2.在 quartz.properties 中配置相關引數 如下org.quartz.scheduler.instancename...

Flask框架在Ajax請求中開啟CSRF保護

前面flask學習總結筆記 5 form表單中對表單提交中開啟csrf保護進行了詳細講解。雖然ajax不同於表單提交,但是我們同樣可以手動利用相同的辦法,開啟csrf保護。表單類 class loginform form 登入表單類 email stringfield txtloginemail v...

Spring框架 在Ioc容器中配置Bean

配置bean 配置形式 基於xml檔案的方式,基於註解的方式 bean的配置方式 通過全類名 反射 通過工廠方法 靜態工廠方法 例項工廠方法 factorybean 依賴注入的方式 屬性注入,構造器注入 注入屬性值細節 自動轉配 bean之間的關係 繼承 依賴 bean的作用域 singleton ...