我通过复制目标将iphone xib复制到iPad xib中,现在我的大部分xib都被正确转换为iPad大小,但是有些xib仍然仅显示为iphone大小。除了大多数GUI功能,如警报视图显示,行动表都不是根据iPad。我需要做些什么改变才能完美地适用于iPad。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
编辑:GUI问题我在行动表中给出了两个选项YES和NO,只有YES显示NO隐藏在某个地方..
感谢
答案 0 :(得分:1)
应用启动时,您没有加载正确的NIB。这是Xcode“Single View”应用程序模板提供的代码,它检测设备并加载相应的NIB文件:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[MainViewController alloc] initWithNibName:@"MainViewController_iPhone" bundle:nil];
} else {
self.viewController = [[MainViewController alloc] initWithNibName:@"MainViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
答案 1 :(得分:1)
问题不在于转换,它与ipad中的Action表的使用有关。检查如何在ipad中使用操作表,
它可以解决您的问题