开发者

Loading NSView from NIB won't work

开发者 https://www.devze.com 2023-01-19 22:29 出处:网络
I have this code to load an NSView from a NIB and add it to another NSView: // INIT - (void)awakeFromNib {

I have this code to load an NSView from a NIB and add it to another NSView:

// INIT
- (void)awakeFromNib {
  // Load nib
  DNListViewController *listViewController = [[DNListViewCont开发者_高级运维roller alloc] initWithNibName:@"ListView" bundle:nil];

  // Add view to window
  [listViewController.view setFrame:detailView.frame];
  [detailView addSubview:listViewController.view];

  // MEM
  [listViewController release];
}

All outlets are connected right, but nothing shows up. I don't understand why! Can someone help me? Thanks.


This is about NSViews, not UIViews!


Oh, I fixed it already. Nevermind, I'll let is stay here for people from the future.

[listViewController.view setFrame:detailView.frame];

must be

[listViewController.view setFrame:detailView.bounds];
0

精彩评论

暂无评论...
验证码 换一张
取 消