UITextView使用筆記

2021-06-19 03:53:25 字數 2499 閱讀 2616

uitextview初始化:

uitextview *inputcontexttf = [[uitextview

alloc] initwithframe:cgrectmake(contactphoneimage.frame.origin.x, contactphoneimage.frame.origin.y+contactphoneimage.frame.size.height, contactphoneimage.frame.size.width, self.view.bounds.size.height-contactphoneimage.frame.origin.y-contactphoneimage.frame.size.height-70)];

inputcontexttf.tag = dtaginputtf;

//    inputcontexttf.placeholder = @"  請輸入內容:";

inputcontexttf.text = @"

請輸入內容:

";inputcontexttf.backgroundcolor = [uicolor

clearcolor];

inputcontexttf.delegate = self;

inputcontexttf.font = [uifont

systemfontofsize:15];

inputcontexttf.textcolor = [self

colorwithhexstring:@"#4d4d4d"];

inputcontexttf.returnkeytype= uireturnkeydefault;

//定義乙個*******

ui******* * topview = [[ui*******

alloc]initwithframe:cgrectmake(0, 0, 320, 30)];

//設定style

[topview setbarstyle:uibarstyleblack];

uibarbuttonitem

* hellobutton = [[

uibarbuttonitem

alloc]initwithtitle:

@"取消

"style:uibarbuttonitemstyledonetarget:

self

action:

@selector

(resignkeyboard)];

//定義兩個flexiblespace的button,放在*******上,這樣完成按鈕就會在最右邊

uibarbuttonitem

* button1 =[[

uibarbuttonitem

alloc]initwithbarbuttonsystemitem:                                        uibarbuttonsystemitemflexiblespacetarget:

self

action:

nil];

//    uibarbuttonitem * button2 = [[uibarbuttonitem  alloc]initwithbarbuttonsystemitem:                                        uibarbuttonsystemitemflexiblespace target:self action:nil];

//定義完成按鈕

uibarbuttonitem

* donebutton = [[

uibarbuttonitem

alloc]initwithtitle:

@"完成

"style:uibarbuttonitemstyledonetarget:

self

action:

@selector

(resignkeyboard)];

//在*******上加上這些按鈕

nsarray * buttonsarray = [nsarray

arraywithobjects:hellobutton,button1,donebutton,nil];

[topview setitems:buttonsarray];

[inputcontexttf setinputaccessoryview:topview];

uitextview delegate methond

//隱藏鍵盤

- (void)resignkeyboard

- (void)textviewdidbeginediting:(uitextview *)textview

- (void)textviewdidendediting:(uitextview *)textview

// view 移動~~~

- (void)moveinputbarwithkeyboardheight:(float)_cgrectheight withduration:(nstimeinterval)_nstimeinterval

Vim 使用筆記

set hlsearch set nohlsearch 搜尋後清除上次的加亮 nohl nohlsearch 拷貝 很有用的一句話,規定了格式選項,讓它換行不自動空格 set formatoptions tcrqn set fo r set noautoindent 再 shift insert 正...

xemacs使用筆記

xemacs使用筆記 xemacs emacs的下一代,由lucid原創 from debian參考手冊.由於不知道什麼時候刪掉了emacs的乙個重要檔案.每次都沒法安裝好.突然發現了xemacs,於是決定使用看看.本人還是菜鳥,僅供交流 我使用的ubuntu系統,所以就直接apt get inst...

TreeView使用筆記

treeview由節點構成,建樹通過對treeview.items屬性進行操作。items是乙個ttreenodes物件,這是乙個ttreenode集。一 針對ttreenodes,也就是 treeview.items,有這些屬性 1 count,節點個數。2 item index 通過index得...