iOS:自定义按钮未显示在情节提要上

iOS:自定义按钮未显示在情节提要上,ios,button,interface,storyboard,builder,Ios,Button,Interface,Storyboard,Builder,我在我的故事板中以编程方式显示图像,并成功地处理横向/纵向方向(参见下面的代码)。我现在正试图通过Interface Builder直接在情节提要中的同一视图上添加自定义按钮。该按钮在应用程序运行时不会显示。只有图像。你能在情节提要视图上告诉我怎么做吗?或者我也应该按程序添加它?还是在Interface builder中100%重做所有内容?我真的不知道如何混合和匹配这两种方法 - (void)viewDidLoad { [super viewDidLoad]; // Do an

我在我的故事板中以编程方式显示图像,并成功地处理横向/纵向方向(参见下面的代码)。我现在正试图通过Interface Builder直接在情节提要中的同一视图上添加自定义按钮。该按钮在应用程序运行时不会显示。只有图像。你能在情节提要视图上告诉我怎么做吗?或者我也应该按程序添加它?还是在Interface builder中100%重做所有内容?我真的不知道如何混合和匹配这两种方法

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [[self navigationController] setNavigationBarHidden:YES animated:YES];



    UIImage *startImage = [UIImage imageNamed:@"title.png"];
    UIImageView *startImageView = [[UIImageView alloc] initWithImage:startImage];

    self.startImageView = startImageView;

    [self.view addSubview:startImageView];


}

- (void) orientStartImageView
{
     UIInterfaceOrientation curOrientation = [UIApplication sharedApplication].statusBarOrientation;
     if (curOrientation == UIInterfaceOrientationPortrait || curOrientation == UIInterfaceOrientationPortraitUpsideDown) {
     [self.startImageView setFrame:CGRectMake(-128, 0, 1024, 1024)];
 }else{
     [self.startImageView setFrame:CGRectMake(0, -128, 1024, 1024)];
 }
}

- (void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self orientStartImageView];
}

- (void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];
    [self orientStartImageView];
}

当您在按钮顶部添加ImageView时,您可以使用此代码将其带到前面,将其放入
viewdiload
方法:

[self.view bringSubviewToFront:yourBtn];

当您在按钮顶部添加ImageView时,您可以使用此代码将其带到前面,将其放入
viewdiload
方法:

[self.view bringSubviewToFront:yourBtn];

谢谢我真想知道这个应用程序如何处理图像的排序;[self.view insertSubview:atIndex:];[self.view insertSubview:belowSubview:];谢谢我真想知道这个应用程序如何处理图像的排序;[self.view insertSubview:atIndex:];[self.view insertSubview:belowSubview:];