Danh mục NSTimer(GCKAdditions)
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Một danh mục trên NSTimer có bổ sung một số tính năng nâng cao hữu ích.
+ (NSTimer *) gck_scheduledTimerWithTimeInterval: |
|
(NSTimeInterval) |
interval |
weakTarget: |
|
(id) |
target |
selector: |
|
(SEL) |
selector |
userInfo: |
|
(nullable id) |
userInfo |
repeats: |
|
(BOOL) |
repeats |
|
|
| |
Tạo NSTimer có mục tiêu yếu.
Tránh lặp lại giữa bộ tính giờ và mục tiêu. Bộ tính giờ sẽ tự động mất hiệu lực nếu mục tiêu đã được giải phóng khi bộ tính giờ kích hoạt.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2023-12-02 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2023-12-02 UTC."],[[["This category provides useful enhancements to the standard `NSTimer` class."],["It introduces a method to create timers with weak targets, preventing retain cycles."],["Timers created with this category automatically invalidate if the target is released."]]],["The document describes an NSTimer category enhancement called `gck_scheduledTimerWithTimeInterval`. This class method constructs an NSTimer with a weak target, preventing retain loops. It takes parameters for the time interval, target, selector, user info, and whether the timer repeats. If the target is released when the timer fires, the timer automatically invalidates itself. It adds the ability to use NSTimers without the risk of creating retain cycles.\n"]]