iphone模拟器上截图
从模拟器上截图,原来需要按住Control键时截图功能才会出现在Edit菜单中。也可以使用mac自带的截图功能。
上面是抄http://www.cnblogs.com/a7345678/archive/2012/02/04/2338243.html这里来的, 因为效果需要截图,所以找了下模拟器上如何截图。
下图是效果:
以下为步骤和关键代码:
1.新建一个windows based程序,删掉xib文件。在设置中的summary下面iPhone/iPod Deployment info去掉main interface
2.在delegate中注释掉- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法,
加上-(void)applicationDidFinishLaunching:(UIApplication *)application方法
3关键代码:
在新加上的方法里面,添加如下代码:
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
//First view
myViewController *myvc;
myvc = [[myViewController alloc]init];
myvc.title = @"Root";
myvc.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:0];
//Second view
myViewController2 *myvc2;
myvc2 = [[myViewController2 alloc]init];
myvc2.title = @"Second";
myvc2.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:0];
//Third view
myViewController2 *myvc3;
myvc3 = [[myViewController2 alloc]init];
myvc3.title = @"Third";
myvc3.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:0];
// create a tab bar controller
tabBarController = [[UITabBarController alloc] init];
// create each Navigation controller
navController = [[UINavigationController alloc] init];
[navController pushViewController:myvc animated:NO];
// add navigation controllers to the tab bar controller
tabBarController.viewControllers = [[NSArray alloc]initWithObjects:navController, myvc2, myvc3 ,nil];
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
当然,你在