Create uiTabBarController programmatically

前端 未结 5 2408
隐瞒了意图╮
隐瞒了意图╮ 2021-02-14 09:06

I want to create a UIView for a UITabBarController

Here is my code for the .h file :

@interface TE : UIViewContro         


        
5条回答
  •  青春惊慌失措
    2021-02-14 09:56

    Trying changing

    self.view = tabBarController.view;

    to

    [self.view addSubview:tabBarController.view];

    See if that helps.

    Also try placing this in your -(void)loadView method

    - (void)loadView {
    
        UIView *mv = [[UIView alloc] initWithFrame:CGRectMake(0.0, 100.0, 320.0, 480.0)];
    
        self.view = mv;
    
        [mv release];
    }
    

    The reason you probably are experiencing a black screen is because you haven't initialized your UIView properly.

提交回复
热议问题