gpt4 book ai didi

ios - imageView 一直被 navigationItem 遮挡

转载 作者:行者123 更新时间:2023-11-29 02:52:44 26 4
gpt4 key购买 nike

我找到了一些示例代码。

它通过AppDelegate.m中的代码显示 View

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.

UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

if (notification) {
NSLog(@"AppDelegate didFinishLaunchingWithOptions");
application.applicationIconBadgeNumber = 0;
}

AITPreviewViewController *previewViewController = [[AITPreviewViewController alloc] initWithNibName:@"AITPreviewViewController" bundle:nil];

navigationController = [[UINavigationController alloc]initWithRootViewController:previewViewController];

[self.window setRootViewController:navigationController] ;

self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}

下图在AITPreviewViewController.xib中。

enter image description here

但是在iPhone上运行View不正常,如下图所示。

最上面的三个imageView一直被navigationItem遮挡

enter image description here

但是当我转向其他 View 时,并使用以下代码返回。

UIViewController *Previewer = [[AITPreviewViewController alloc] initWithNibName:@"AITPreviewViewController" bundle:nil] ;

Previewer.edgesForExtendedLayout = UIRectEdgeNone;

[self.navigationController pushViewController:Previewer animated:YES];

它显示了如下图所示的普通 View 。

enter image description here

第一次只显示不正常...这是怎么回事?

是否可以使用Auto-layout来解决这个问题?

最佳答案

如果你不想隐藏导航栏,那么在你的 xib 中做一点改变 Just change the Top Bar property from none to as shown in image

只需将顶部栏属性从无更改为如图所示。它会自动将您的图片放在导航栏下方

关于ios - imageView 一直被 navigationItem 遮挡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24304567/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com