我在 AppDelegate.m 文件中创建了 UIImageView 和 UILabel 以显示标题图像
我的默认方向是横向模式,但我无法正确显示图像,如下图所示
所需的结果应该如下图所示
我还尝试在我的AppDelegate.m
文件中旋转图像和标签这是我的代码
但它不显示图像并且标题只是消失了。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[LMSFirstViewController alloc] initWithNibName:@"LMSFirstViewController" bundle:nil];
UIViewController *viewController2 = [[LMSSecondViewController alloc] initWithNibName:@"LMSSecondViewController" bundle:nil];
UIViewController *viewController3 = [[LMSThirdViewController alloc] initWithNibName:@"LMSThirdViewController" bundle:nil];
UILabel *title=[[UILabel alloc]initWithFrame:CGRectMake(50, 0, 5000, 50)];
title.text=@"Library Management System";
[title setFont:[UIFont systemFontOfSize:24]];
[title setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0]];
title.textColor=[UIColor redColor];
title.transform=CGAffineTransformMakeRotation(M_PI_2);
UIImageView *imageView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 5000, 50)];
imageView.image=[UIImage imageNamed:@"LMS.jpg"];
imageView.transform=CGAffineTransformMakeRotation(M_PI_2);
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2,viewController3,nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
[self.window addSubview:imageView];
[self.window addSubview:title];
return YES;
}