0

iPhoneとiPadのアプリでを使用していUITabBarますが、横向きモードにすると自動サイズ変更がiPadで機能しません(iPhoneでは正常に機能します)。

{
    tabBarController =[[UITabBarController alloc]init];
    tabBarController.delegate=self;
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:navController1,navController2, navController3,navController4,navController5,nil];
    tabBarController.selectedViewController = navController1;
    imgTab = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,768.0,51)];
    [imgTab setAutoresizingMask: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleBottomMargin |   UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin]; imgTab.image=[UIImage imageNamed:@"footerbg.jpg"];
    [tabBarController.tabBar addSubview:imgTab];
    accountImg=[[UIImageView alloc]initWithFrame:CGRectMake(150.0,5.0,29.0,29.0)];
    [accountImg setAutoresizingMask: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleBottomMargin |   UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
    accountImg.image=[UIImage imageNamed:@"click11.png"];
    UITabBarItem *tabItem = [[[tabBarController tabBar] items] objectAtIndex:0];
    [tabItem setTitle:@"Task"];
    [imgTab addSubview:accountImg];
    staffImg=[[UIImageView alloc]initWithFrame:CGRectMake(255,5.0,29.0,29.0)];
    staffImg.image=[UIImage imageNamed:@"spreadsheet11-1.png"];
    UITabBarItem *tabItem1 = [[[tabBarController tabBar] items] objectAtIndex:1];
    [tabItem1 setTitle:@"SpreadSheet"];
    [staffImg setAutoresizingMask: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleBottomMargin |   UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
    [imgTab addSubview:staffImg];
    taskImg=[[UIImageView alloc]initWithFrame:CGRectMake(370.0,5.0,29.0,29.0)];
    taskImg.image=[UIImage imageNamed:@"calendar2.png"];
    UITabBarItem *tabItem2 = [[[tabBarController tabBar] items] objectAtIndex:2];
    [tabItem2 setTitle:@"Calendar"];
    [taskImg setAutoresizingMask: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleBottomMargin |   UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
    [imgTab addSubview:taskImg];
    spreadImg =[[UIImageView alloc]initWithFrame:CGRectMake(472.0,5.0,29.0,29.0)];
    spreadImg.image=[UIImage imageNamed:@"message22.png"];
    UITabBarItem *tabItem3 = [[[tabBarController tabBar] items] objectAtIndex:3];
    [tabItem3 setTitle:@"Message"];
    [spreadImg setAutoresizingMask: UIViewAutoresizingFlexibleHeight |   UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleBottomMargin |   UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
    [imgTab addSubview:spreadImg];

}
4

1 に答える 1

0

このコードのどこにも、UITabBarのUIAutoresizingMaskを構成していることはわかりませんが、その中のアイテムに対してのみです。

于 2013-01-23T17:33:34.323 に答える