viewController クラスに UIView を表示しようとしています。viewController のメソッドから initCard メソッドを呼び出しますviewDidLoad
。最初の機能は機能しますが、2 番目の機能は機能しません。関数の 2 番目のバージョンでは、表示しようとしているビューが表示されませんが、プログラムの残りの部分は正常に機能します。私は何を間違っていますか?
からのメソッド呼び出しviewDidLoad
、動作:
[self initCard];
- (void) initCard {
[[NSBundle mainBundle] loadNibNamed:@"Card1View_iPhone" owner:self options:nil];
[self.view addSubview:self.card1ContainerView];
self.card1ImageView.image = [UIImage imageNamed:@"b1fv.png"];
CGRect sFrame = CGRectMake(100, 100,
self.card1ContainerView.frame.size.width,
self.card1ContainerView.frame.size.height);
self.card1ContainerView.frame = sFrame;
}
からのメソッド呼び出しはviewDidLoad
機能しません:
[self initCard:self.card1ContainerView cardImageView:self.card1ImageView];
- (void) initCard: (UIView*)cardContainerView cardImageView:(UIImageView*)cardImageView {
[[NSBundle mainBundle] loadNibNamed:@"Card1View_iPhone" owner:self options:nil];
[self.view addSubview:cardContainerView];
cardImageView.image = [UIImage imageNamed:@"b1fv.png"];
CGRect sFrame = CGRectMake(100, 100,
cardContainerView.frame.size.width,
cardContainerView.frame.size.height);
cardContainerView.frame = sFrame;
}