初始化用户默认值的最佳窗口控制器方法
在读取用户默认值并在 windowDidLoad
中设置它们时,初始化窗口中的复选框时会出现轻微延迟。有更好的地方可以做到这一点吗?
这是我的首选窗口控制器类中的代码。
- (void)windowDidLoad
{
[super windowDidLoad];
NSLog(@"Preferences nib loaded.");
[showLikesCheckbox setState:[self showLikes]];
[showFollowsCheckbox setState:[self showFollows]];
[showCommentsCheckbox setState:[self showComments]];
}
There is a slight delay when initializing checkboxes in my window when reading user defaults and setting them in windowDidLoad
. Is there a better place to do this?
This is the code in my preference window controller class.
- (void)windowDidLoad
{
[super windowDidLoad];
NSLog(@"Preferences nib loaded.");
[showLikesCheckbox setState:[self showLikes]];
[showFollowsCheckbox setState:[self showFollows]];
[showCommentsCheckbox setState:[self showComments]];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
建议使用方法
-awakeFromNib
来执行此操作。The method
-awakeFromNib
is recommended for doing this.