01/10/2018, 14:16

Hỏi về cách custom NSTextfield Cocoa trên MacOS (Objective C)

Em muốn làm float placedholder textfield trên Mac OS X xin anh chị hướng dẫn?
Em search thấy toàn bên IOS mà NSTextfield bên Mac OS X không hỗ trợ các hàm như bên UITextfield (IOS) để làm được như vậy?

Hung viết 16:26 ngày 01/10/2018
var placeholderString: String? { get set }
@NSCopying var placeholderAttributedString: NSAttributedString? { get set }

https://developer.apple.com/documentation/appkit/nstextfield

Hong Tran viết 16:30 ngày 01/10/2018

Default không có hiệu ứng ạ.
Em muốn làm có hiệu ứng kiểu như hình dưới ạ

Hung viết 16:21 ngày 01/10/2018

Cái đó bạn tự custom lại. Tạo view mới có 1 property là TextField, Label, View. Label làm chức năng placeholder. View cho border phía dưới
Tuỳ vào State của TextField làm hiệu ứng cho Label (translate + scale), và View.width

Hong Tran viết 16:25 ngày 01/10/2018

anh cho em xin tài liệu rõ hơn về cách xử lý View không ạ? Em tìm toàn ra IOS nó khác quá
Em trước giờ toàn sử dụng có sẵn chưa rõ về cách làm

Hung viết 16:26 ngày 01/10/2018

Thấy nó chẳng có gì khác. @@

View
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40002978-CH1-SW1
Event
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/EventOverview/Introduction/Introduction.html#//apple_ref/doc/uid/10000060i
Drawing
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40003290

Bài liên quan
0