Build xib Interface Builder and load them as subview in iphone

给你一囗甜甜゛ 提交于 2019-12-04 18:24:52
Leonardo

I found solution myself, after looking at some stackoverflow thread. So I would like to share what I found and see if it's an acceptable solution. Basically this is what I did:

  1. create a MyView.m view file with all my required IBOutlet
  2. build a MyView.xib view in interface builder, leaving default file's owner and set view as MyView.m
  3. use this piece of code

      NSArray *xib = [[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil];
      MyView * myView = [xib objectAtIndex:0];
      [self addSubview:myView];
    

It works, actually...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!