我在iOS 6中创建了一个新的Tabbed应用程序
但是我想在顶部添加一个图像,以便在我的项目中它是相同的
在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];
**UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 80, 1024)];
imageView.image=[UIImage imageNamed:@"LMS.jpg"];**
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2,viewController3,nil];
self.window.rootViewController = self.tabBarController;
**[self.window addSubview:imageView];**
[self.window makeKeyAndVisible];
return YES;
}
但是它没有加载任何图像
我应该怎样做才能以任何其他方式添加图像来实现这个
谢谢,阿伦。
答案 0 :(得分:0)
一旦这样检查它会起作用,
在调用[self.window makeKeyAndVisible];
方法后添加子视图,通常是在加载前添加子视图的情况。
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
[self.window addSubview:imageView];