@interface SearchingPropertyViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIView *searchingView
我加入了下面的代碼,按鈕操作在另一個視圖控制器
SearchingPropertyViewController *ps = [[[NSBundle mainBundle] loadNibNamed:@"SearchingPropertyViewController" owner:self options:nil] objectAtIndex:0];
[self.view addSubview:ps.searchingView];
我只是想加載searchingView在另一視圖控制器
不是'[self.view addSubview:ps.searchingView]'是'[self.view addSubview:ps.view]',如果你的searchingView在SearchingPropertyViewController加載其自動出現在預覽 –
不,我想從xib文件加載searchView到另一個視圖控制器 –
'SearchingPropertyViewController * ps = [[SearchingPropertyViewController alloc] initWithNibName:@「SearchingPropertyViewController」bundle:nil]; [self.view addSubview:ps.searchingView];'? – Larme