2
我需要在我的應用程序中實現此設計,但我無法找出一種方法將此約束添加到導航欄。添加約束導航欄
我嘗試添加約束與負頂部佈局導向偏移,但導航欄始終在最前面
是否有使用NSLayoutconstraints與導航創建這個特定的佈局方式酒吧?
我需要在我的應用程序中實現此設計,但我無法找出一種方法將此約束添加到導航欄。添加約束導航欄
我嘗試添加約束與負頂部佈局導向偏移,但導航欄始終在最前面
是否有使用NSLayoutconstraints與導航創建這個特定的佈局方式酒吧?
要實現這種設計,您可以按下面的代碼將按鈕放在窗口視圖上。
UIWindow *appWindow = [[[UIApplication sharedApplication] delegate] window];
UIButton *aButton = [UIButton buttonWithType:UIButtonTypeSystem];
[aButton setFrame:CGRectMake((appWindow.frame.size.width/2)-35, 20, 70, 100)];
[appWindow addSubview:aButton];
此外,您還可以使用
[[UIApplication sharedApplication] keyWindow]
得到窗口
你嘗試過這麼遠嗎? –
我試圖給頂部佈局指南添加一個負偏移約束,但導航欄始終位於頂部 – slimboy
然後請將其添加到您的問題 –