Create uiTabBarController programmatically

前端 未结 4 1481
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 09:23

I want to create a UIView for a UITabBarController

Here is my code for the .h file :

@interface TE : UIViewContro         


        
4条回答
  •  误落风尘
    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.

提交回复
热议问题