[英]auto layout button position
我對新的自動版式功能有一個簡單的問題。 我有一個可以在iphone 4、4s和5上運行的應用程序。我需要在屏幕上放置一個按鈕,並且該按鈕需要在4英寸屏幕上距臀部302像素,在3.5英寸處需要282像素(都在視網膜上解析度)。 我該如何完成?
我找到了很多教程,但似乎都沒有涵蓋我所追求的內容。 有任何想法嗎?
如果您的版本低於iOS 6.0,則使用自動版式時該應用將崩潰。 它僅適用於iOS 6。
也就是說,在支持舊版iOS的同時如何處理不同的屏幕高度:
你做一個宏
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
並可以像這樣檢查
if( IS_IPHONE_5 )
{
//position the button 302 px from bottom of the screen
}
else
{
//position the button 282 pixels from the bottom of the screen
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.